1 # -*- coding: utf-8 -*- |
1 # -*- coding: utf-8 -*- |
2 # copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
3 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
4 # |
4 # |
5 # This file is part of CubicWeb. |
5 # This file is part of CubicWeb. |
6 # |
6 # |
7 # CubicWeb is free software: you can redistribute it and/or modify it under the |
7 # CubicWeb is free software: you can redistribute it and/or modify it under the |
37 'WHERE Y is EmailAddress, P is EmailPart')[0][0] |
37 'WHERE Y is EmailAddress, P is EmailPart')[0][0] |
38 self.execute('SET X sender Y WHERE X is Email, Y is EmailAddress') |
38 self.execute('SET X sender Y WHERE X is Email, Y is EmailAddress') |
39 rset = self.execute('Any S WHERE X sender S, X eid %s' % eeid) |
39 rset = self.execute('Any S WHERE X sender S, X eid %s' % eeid) |
40 self.assertEqual(len(rset), 1) |
40 self.assertEqual(len(rset), 1) |
41 |
41 |
|
42 def test_symmetric(self): |
|
43 req = self.request() |
|
44 u1 = self.create_user(req, u'1') |
|
45 u2 = self.create_user(req, u'2') |
|
46 u3 = self.create_user(req, u'3') |
|
47 ga = req.create_entity('CWGroup', name=u'A') |
|
48 gb = req.create_entity('CWGroup', name=u'B') |
|
49 u1.cw_set(friend=u2) |
|
50 u2.cw_set(friend=u3) |
|
51 ga.cw_set(friend=gb) |
|
52 ga.cw_set(friend=u1) |
|
53 self.commit() |
|
54 req = self.request() |
|
55 for l1, l2 in ((u'1', u'2'), |
|
56 (u'2', u'3')): |
|
57 self.assertTrue(req.execute('Any U1,U2 WHERE U1 friend U2, U1 login %(l1)s, U2 login %(l2)s', |
|
58 {'l1': l1, 'l2': l2})) |
|
59 self.assertTrue(req.execute('Any U1,U2 WHERE U2 friend U1, U1 login %(l1)s, U2 login %(l2)s', |
|
60 {'l1': l1, 'l2': l2})) |
|
61 self.assertTrue(req.execute('Any GA,GB WHERE GA friend GB, GA name "A", GB name "B"')) |
|
62 self.assertTrue(req.execute('Any GA,GB WHERE GB friend GA, GA name "A", GB name "B"')) |
|
63 self.assertTrue(req.execute('Any GA,U1 WHERE GA friend U1, GA name "A", U1 login "1"')) |
|
64 self.assertTrue(req.execute('Any GA,U1 WHERE U1 friend GA, GA name "A", U1 login "1"')) |
|
65 self.assertFalse(req.execute('Any GA,U WHERE GA friend U, GA name "A", U login "2"')) |
|
66 for l1, l2 in ((u'1', u'3'), |
|
67 (u'3', u'1')): |
|
68 self.assertFalse(req.execute('Any U1,U2 WHERE U1 friend U2, U1 login %(l1)s, U2 login %(l2)s', |
|
69 {'l1': l1, 'l2': l2})) |
|
70 self.assertFalse(req.execute('Any U1,U2 WHERE U2 friend U1, U1 login %(l1)s, U2 login %(l2)s', |
|
71 {'l1': l1, 'l2': l2})) |
|
72 |
42 def test_html_tidy_hook(self): |
73 def test_html_tidy_hook(self): |
43 req = self.request() |
74 req = self.request() |
44 entity = req.create_entity('Workflow', name=u'wf1', |
75 entity = req.create_entity('Workflow', name=u'wf1', |
45 description_format=u'text/html', |
76 description_format=u'text/html', |
46 description=u'yo') |
77 description=u'yo') |