test fixes stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 21 Oct 2009 14:31:15 +0200
branchstable
changeset 3771 234b003f0fe0
parent 3770 957e7cffdefb
child 3772 316d0b524db8
test fixes
server/test/unittest_repository.py
test/unittest_entity.py
web/test/unittest_views_baseviews.py
web/test/unittest_views_editforms.py
--- a/server/test/unittest_repository.py	Wed Oct 21 13:52:16 2009 +0200
+++ b/server/test/unittest_repository.py	Wed Oct 21 14:31:15 2009 +0200
@@ -109,14 +109,13 @@
         self.assert_(repo.connect(u"barnabé", u"héhéhé".encode('UTF8')))
 
     def test_invalid_entity_rollback(self):
-        repo = self.repo
-        cnxid = repo.connect(*self.default_user_password())
+        cnxid = self.repo.connect(*self.default_user_password())
         # no group
-        repo.execute(cnxid, 'INSERT CWUser X: X login %(login)s, X upassword %(passwd)s',
-                     {'login': u"tutetute", 'passwd': 'tutetute'})
-        self.assertRaises(ValidationError, repo.commit, cnxid)
-        rset = repo.execute(cnxid, 'CWUser X WHERE X login "tutetute"')
-        self.assertEquals(rset.rowcount, 0)
+        self.repo.execute(cnxid,
+                          'INSERT CWUser X: X login %(login)s, X upassword %(passwd)s',
+                          {'login': u"tutetute", 'passwd': 'tutetute'})
+        self.assertRaises(ValidationError, self.repo.commit, cnxid)
+        self.failIf(self.repo.execute(cnxid, 'CWUser X WHERE X login "tutetute"'))
 
     def test_close(self):
         repo = self.repo
@@ -225,7 +224,7 @@
                                if not r.type in ('eid', 'is', 'is_instance_of', 'identity',
                                                  'creation_date', 'modification_date', 'cwuri',
                                                  'owned_by', 'created_by')],
-                              ['relation_type', 'from_entity', 'in_basket', 'to_entity', 'constrained_by',
+                              ['relation_type', 'from_entity', 'to_entity', 'in_basket', 'constrained_by',
                                'cardinality', 'ordernum',
                                'indexed', 'fulltextindexed', 'internationalizable',
                                'defaultval', 'description', 'description_format'])
--- a/test/unittest_entity.py	Wed Oct 21 13:52:16 2009 +0200
+++ b/test/unittest_entity.py	Wed Oct 21 14:31:15 2009 +0200
@@ -203,7 +203,7 @@
                           'X modification_date AA')
         self.assertEquals(tag.related_rql('tags', 'subject', ('Personne',)),
                           'Any X,AA,AB ORDERBY AA ASC '
-                          'WHERE E eid %(x)s, E tags X, E is IN (Personne), X nom AA, '
+                          'WHERE E eid %(x)s, E tags X, X is IN (Personne), X nom AA, '
                           'X modification_date AB')
 
     def test_unrelated_rql_security_1(self):
--- a/web/test/unittest_views_baseviews.py	Wed Oct 21 13:52:16 2009 +0200
+++ b/web/test/unittest_views_baseviews.py	Wed Oct 21 14:31:15 2009 +0200
@@ -99,7 +99,7 @@
 
     def test_sortvalue(self):
         e, _, view = self._prepare_entity()
-        expected = ['<toto>', 'loo"ong blabla'[:10], e.creation_date.strftime('%Y-%m-%d %H:%M')]
+        expected = ['<toto>', 'loo"ong blabla'[:10], e.creation_date.strftime('%Y/%m/%d %H:%M:%S')]
         got = [loadjson(view.sortvalue(0, i)) for i in xrange(3)]
         self.assertListEqual(got, expected)
         # XXX sqlite does not handle Interval correctly
@@ -111,7 +111,7 @@
         labels = view.columns_labels()
         table = TableWidget(view)
         table.columns = view.get_columns(labels, [1, 2], None, None, None, None, 0)
-        expected = ['loo"ong blabla'[:10], e.creation_date.strftime('%Y-%m-%d %H:%M')]
+        expected = ['loo"ong blabla'[:10], e.creation_date.strftime('%Y/%m/%d %H:%M:%S')]
         got = [loadjson(value) for _, value in table.itercols(0)]
         self.assertListEqual(got, expected)
 
--- a/web/test/unittest_views_editforms.py	Wed Oct 21 13:52:16 2009 +0200
+++ b/web/test/unittest_views_editforms.py	Wed Oct 21 14:31:15 2009 +0200
@@ -44,10 +44,10 @@
                                ])
         self.assertListEquals(rbc(e, 'metadata'),
                               [('last_login_time', 'subject'),
+                               ('modification_date', 'subject'),
                                ('created_by', 'subject'),
                                ('creation_date', 'subject'),
                                ('cwuri', 'subject'),
-                               ('modification_date', 'subject'),
                                ('owned_by', 'subject'),
                                ('bookmarked_by', 'object'),
                                ])
@@ -61,10 +61,10 @@
         self.assertListEquals(rbc(e, 'generated'),
                               [('use_email', 'subject'),
                                ('in_state', 'subject'),
+                               ('is', 'subject'),
+                               ('is_instance_of', 'subject'),
                                ('has_text', 'subject'),
                                ('identity', 'subject'),
-                               ('is', 'subject'),
-                               ('is_instance_of', 'subject'),
                                ('tags', 'object'),
                                ('for_user', 'object'),
                                ('created_by', 'object'),
@@ -98,10 +98,10 @@
                                ('salary', 'subject')
                                ])
         self.assertListEquals(rbc(e, 'metadata'),
-                              [('created_by', 'subject'),
-                               ('creation_date', 'subject'),
+                              [('creation_date', 'subject'),
                                ('cwuri', 'subject'),
                                ('modification_date', 'subject'),
+                               ('created_by', 'subject'),
                                ('owned_by', 'subject'),
                                ])
         self.assertListEquals(rbc(e, 'generic'),
@@ -109,9 +109,9 @@
                                ('connait', 'object')
                                ])
         self.assertListEquals(rbc(e, 'generated'),
-                              [('has_text', 'subject'),
+                              [('is', 'subject'),
+                               ('has_text', 'subject'),
                                ('identity', 'subject'),
-                               ('is', 'subject'),
                                ('is_instance_of', 'subject'),
                                ('identity', 'object'),
                                ])