author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Tue, 11 Aug 2009 17:13:32 +0200 | |
changeset 2773 | b2530e3e0afb |
parent 1977 | 606923dff11b |
child 3293 | 69c0ba095536 |
permissions | -rw-r--r-- |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
1 |
""" |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
2 |
|
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
3 |
:organization: Logilab |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
4 |
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
5 |
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
6 |
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
7 |
""" |
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
8 |
from cubicweb.devtools.testlib import CubicWebTC |
0 | 9 |
|
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
10 |
class EmailAddressHooksTC(CubicWebTC): |
0 | 11 |
|
12 |
def test_use_email_set_primary_email(self): |
|
13 |
self.execute('INSERT EmailAddress X: X address "admin@logilab.fr", U use_email X WHERE U login "admin"') |
|
14 |
self.assertEquals(self.execute('Any A WHERE U primary_email X, U login "admin", X address A').rows, |
|
15 |
[]) |
|
16 |
self.commit() |
|
17 |
self.assertEquals(self.execute('Any A WHERE U primary_email X, U login "admin", X address A')[0][0], |
|
18 |
'admin@logilab.fr') |
|
19 |
# having another email should'nt change anything |
|
20 |
self.execute('INSERT EmailAddress X: X address "a@logilab.fr", U use_email X WHERE U login "admin"') |
|
21 |
self.commit() |
|
22 |
self.assertEquals(self.execute('Any A WHERE U primary_email X, U login "admin", X address A')[0][0], |
|
23 |
'admin@logilab.fr') |
|
24 |
||
25 |
def test_primary_email_set_use_email(self): |
|
26 |
self.execute('INSERT EmailAddress X: X address "admin@logilab.fr", U primary_email X WHERE U login "admin"') |
|
27 |
self.assertEquals(self.execute('Any A WHERE U use_email X, U login "admin", X address A').rows, |
|
28 |
[]) |
|
29 |
self.commit() |
|
30 |
self.assertEquals(self.execute('Any A WHERE U use_email X, U login "admin", X address A')[0][0], |
|
31 |
'admin@logilab.fr') |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
32 |
|
0 | 33 |
|
34 |
if __name__ == '__main__': |
|
35 |
from logilab.common.testlib import unittest_main |
|
36 |
unittest_main() |