# HG changeset patch # User Sylvain Thénault # Date 1249138480 -7200 # Node ID c94df21f7ab2dc89f1aea3906251bd9de3ee689c # Parent 273eec072cf835ec49537b17f6a3f623cd614acd F [cw.test] OK diff -r 273eec072cf8 -r c94df21f7ab2 test/unittest_entity.py --- a/test/unittest_entity.py Sat Aug 01 16:54:03 2009 +0200 +++ b/test/unittest_entity.py Sat Aug 01 16:54:40 2009 +0200 @@ -55,7 +55,9 @@ e.copy_relations(oe.eid) self.assertEquals(len(e.ecrit_par), 1) self.assertEquals(e.ecrit_par[0].eid, p.eid) - self.assertEquals(len(e.reverse_tags), 0) + self.assertEquals(len(e.reverse_tags), 1) + # check meta-relations are not copied, set on commit + self.assertEquals(len(e.created_by), 0) def test_copy_with_nonmeta_composite_inlined(self): p = self.add_entity('Personne', nom=u'toto') @@ -215,7 +217,7 @@ e = self.add_entity('Card', title=u'rest test', content=u'du :eid:`1:*ReST*`', content_format=u'text/rest') self.assertEquals(e.printable_value('content'), - '

du *ReST*

\n') + '

du *ReST*

\n') e['content'] = 'du html users' e['content_format'] = 'text/html' self.assertEquals(e.printable_value('content'), @@ -322,19 +324,20 @@ def test_complete_relation(self): self.execute('SET RT add_permission G WHERE RT name "wf_info_for", G name "managers"') self.commit() + session = self.session() try: - eid = self.execute('INSERT TrInfo X: X comment "zou", X wf_info_for U,' - 'X from_state S1, X to_state S2 WHERE ' - 'U login "admin", S1 name "activated", S2 name "deactivated"')[0][0] + eid = session.unsafe_execute( + 'INSERT TrInfo X: X comment "zou", X wf_info_for U, X from_state S1, X to_state S2 ' + 'WHERE U login "admin", S1 name "activated", S2 name "deactivated"')[0][0] trinfo = self.entity('Any X WHERE X eid %(x)s', {'x': eid}, 'x') trinfo.complete() self.failUnless(trinfo.relation_cached('from_state', 'subject')) self.failUnless(trinfo.relation_cached('to_state', 'subject')) self.failUnless(trinfo.relation_cached('wf_info_for', 'subject')) # check with a missing relation - eid = self.execute('INSERT TrInfo X: X comment "zou", X wf_info_for U,' - 'X to_state S2 WHERE ' - 'U login "admin", S2 name "activated"')[0][0] + eid = session.unsafe_execute( + 'INSERT TrInfo X: X comment "zou", X wf_info_for U,X to_state S2 ' + 'WHERE U login "admin", S2 name "activated"')[0][0] trinfo = self.entity('Any X WHERE X eid %(x)s', {'x': eid}, 'x') trinfo.complete() self.failUnless(isinstance(trinfo.creation_date, datetime)) diff -r 273eec072cf8 -r c94df21f7ab2 test/unittest_rset.py --- a/test/unittest_rset.py Sat Aug 01 16:54:03 2009 +0200 +++ b/test/unittest_rset.py Sat Aug 01 16:54:40 2009 +0200 @@ -346,10 +346,9 @@ set(['CWGroup',])) def test_printable_rql(self): - rset = self.execute(u'CWEType X WHERE X final FALSE, X meta FALSE') + rset = self.execute(u'CWEType X WHERE X final FALSE') self.assertEquals(rset.printable_rql(), - 'Any X WHERE X final FALSE, X meta FALSE, X is CWEType') - + 'Any X WHERE X final FALSE, X is CWEType') def test_searched_text(self): rset = self.execute(u'Any X WHERE X has_text "foobar"') diff -r 273eec072cf8 -r c94df21f7ab2 test/unittest_schema.py --- a/test/unittest_schema.py Sat Aug 01 16:54:03 2009 +0200 +++ b/test/unittest_schema.py Sat Aug 01 16:54:40 2009 +0200 @@ -16,6 +16,7 @@ from yams import BadSchemaDefinition from yams.constraints import SizeConstraint, StaticVocabularyConstraint from yams.buildobjs import RelationDefinition, EntityType, RelationType +from yams.reader import PyFileReader from cubicweb.schema import CubicWebSchema, CubicWebEntitySchema, \ RQLConstraint, CubicWebSchemaLoader, ERQLExpression, RRQLExpression, \ @@ -133,12 +134,6 @@ class SQLSchemaReaderClassTest(TestCase): - def test_knownValues_include_schema_files(self): - schema_files = loader.include_schema_files('Bookmark') - for file in schema_files: - self.assert_(isabs(file)) - self.assertListEquals([basename(f) for f in schema_files], ['Bookmark.py']) - def test_knownValues_load_schema(self): schema = loader.load(config) self.assert_(isinstance(schema, CubicWebSchema)) @@ -233,7 +228,7 @@ self.loader = CubicWebSchemaLoader() self.loader.defined = {} self.loader.loaded_files = [] - self.loader._instantiate_handlers() + self.loader._pyreader = PyFileReader(self.loader) def _test(self, schemafile, msg): self.loader.handle_file(join(DATADIR, schemafile)) diff -r 273eec072cf8 -r c94df21f7ab2 test/unittest_utils.py --- a/test/unittest_utils.py Sat Aug 01 16:54:03 2009 +0200 +++ b/test/unittest_utils.py Sat Aug 01 16:54:40 2009 +0200 @@ -8,7 +8,7 @@ from logilab.common.testlib import TestCase, unittest_main -from cubicweb.common.utils import make_uid, UStringIO, SizeConstrainedList +from cubicweb.utils import make_uid, UStringIO, SizeConstrainedList class MakeUidTC(TestCase):