equal
deleted
inserted
replaced
|
1 from cubicweb.devtools.apptest import EnvBasedTC |
|
2 |
|
3 class EmailAddressHooksTC(EnvBasedTC): |
|
4 |
|
5 def test_use_email_set_primary_email(self): |
|
6 self.execute('INSERT EmailAddress X: X address "admin@logilab.fr", U use_email X WHERE U login "admin"') |
|
7 self.assertEquals(self.execute('Any A WHERE U primary_email X, U login "admin", X address A').rows, |
|
8 []) |
|
9 self.commit() |
|
10 self.assertEquals(self.execute('Any A WHERE U primary_email X, U login "admin", X address A')[0][0], |
|
11 'admin@logilab.fr') |
|
12 # having another email should'nt change anything |
|
13 self.execute('INSERT EmailAddress X: X address "a@logilab.fr", U use_email X WHERE U login "admin"') |
|
14 self.commit() |
|
15 self.assertEquals(self.execute('Any A WHERE U primary_email X, U login "admin", X address A')[0][0], |
|
16 'admin@logilab.fr') |
|
17 |
|
18 def test_primary_email_set_use_email(self): |
|
19 self.execute('INSERT EmailAddress X: X address "admin@logilab.fr", U primary_email X WHERE U login "admin"') |
|
20 self.assertEquals(self.execute('Any A WHERE U use_email X, U login "admin", X address A').rows, |
|
21 []) |
|
22 self.commit() |
|
23 self.assertEquals(self.execute('Any A WHERE U use_email X, U login "admin", X address A')[0][0], |
|
24 'admin@logilab.fr') |
|
25 |
|
26 |
|
27 if __name__ == '__main__': |
|
28 from logilab.common.testlib import unittest_main |
|
29 unittest_main() |