Browse Source

Add tests for zpush

Luke Cyca 11 years ago
parent
commit
827206d90f
1 changed files with 25 additions and 1 deletions
  1. 25
    1
      tests.py

+ 25
- 1
tests.py View File

@@ -54,6 +54,30 @@ class WebTests(unittest.TestCase):
54 54
             r.content
55 55
         )
56 56
 
57
+    def test_zpush_http_unauthorized(self):
58
+        r = requests.get('http://mail.' + TEST_SERVER + '/Microsoft-Server-ActiveSync')
59
+
60
+        # We should be redirected to https
61
+        self.assertEquals(r.history[0].status_code, 301)
62
+        self.assertEquals(r.url, 'https://mail.' + TEST_SERVER + '/Microsoft-Server-ActiveSync')
63
+
64
+        # Unauthorized
65
+        self.assertEquals(r.status_code, 401)
66
+
67
+    def test_zpush_https(self):
68
+        r = requests.post('https://mail.' + TEST_SERVER + '/Microsoft-Server-ActiveSync',
69
+                          auth=('sovereign@sovereign.local', 'foo'),
70
+                          params={
71
+                              'DeviceId': '1234',
72
+                              'DeviceType': 'testbot',
73
+                              'Cmd': 'Ping',
74
+                          })
75
+
76
+        self.assertEquals(r.headers['content-type'],
77
+                          'application/vnd.ms-sync.wbxml')
78
+        self.assertEquals(r.headers['ms-server-activesync'],
79
+                          '14.0')
80
+
57 81
     def test_owncloud_http(self):
58 82
         """ownCloud is redirecting to https and displaying login page"""
59 83
         r = requests.get('http://cloud.' + TEST_SERVER)
@@ -263,7 +287,7 @@ class MailTests(unittest.TestCase):
263 287
         _, data = m.fetch(res[0], '(RFC822)')
264 288
 
265 289
         self.assertIn(
266
-            'X-DSPAM-Result: Innocent',
290
+            'X-DSPAM-Result: ',
267 291
             data[0][1]
268 292
         )
269 293
 

Loading…
Cancel
Save