author | Nicolas Chauvat <nicolas.chauvat@logilab.fr> |
Wed, 27 May 2009 12:46:20 +0200 | |
branch | stable |
changeset 1957 | 92d1a15f08f7 |
parent 1802 | d628defebc17 |
child 1977 | 606923dff11b |
permissions | -rw-r--r-- |
0 | 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') |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
25 |
|
0 | 26 |
|
27 |
if __name__ == '__main__': |
|
28 |
from logilab.common.testlib import unittest_main |
|
29 |
unittest_main() |