add a test regarding login with a primary email tls-sprint
authorFlorent <florent@secondweb.fr>
Mon, 27 Apr 2009 19:20:00 +0200
branchtls-sprint
changeset 1489 08acef58ad08
parent 1488 6da89a703c5a
child 1490 6b024694d493
add a test regarding login with a primary email
web/test/unittest_application.py
--- a/web/test/unittest_application.py	Mon Apr 27 19:01:00 2009 +0200
+++ b/web/test/unittest_application.py	Mon Apr 27 19:20:00 2009 +0200
@@ -333,6 +333,19 @@
         self.assertRaises(AuthenticationError, self.publish, req, 'logout')
         self.assertEquals(len(self.open_sessions), 0) 
 
+    def test_cookie_auth_no_anon_login_by_email(self):
+        login = self.request().user.login
+        address = login + u'@localhost'
+        self.execute('INSERT EmailAddress X: X address %(address)s, U primary_email X '
+                     'WHERE U login %(login)s', {'address': address, 'login': login})
+        self.commit()
+        req, origcnx = self._init_auth('cookie')
+        req.form['__login'] = address
+        req.form['__password'] = origcnx.password
+        self._test_auth_succeed(req, origcnx)
+        self.assertRaises(AuthenticationError, self.publish, req, 'logout')
+        self.assertEquals(len(self.open_sessions), 0) 
+
     def _test_auth_anon(self, req):
         self.app.connect(req)
         acnx = req.cnx
@@ -384,8 +397,6 @@
         self.assertRaises(AuthenticationError, self.publish, req, 'logout')
         self.assertEquals(len(self.open_sessions), 0) 
 
-    
 
-        
 if __name__ == '__main__':
     unittest_main()