server/test/unittest_migractions.py
branchstable
changeset 3543 ed152fe5aa8b
parent 3316 c4c07aab1c39
child 3587 5b3725f315fc
--- a/server/test/unittest_migractions.py	Thu Oct 01 09:41:41 2009 +0200
+++ b/server/test/unittest_migractions.py	Thu Oct 01 14:50:10 2009 +0200
@@ -48,12 +48,17 @@
 
     def test_add_attribute_int(self):
         self.failIf('whatever' in self.schema)
+        self.add_entity('Note')
+        self.commit()
         orderdict = dict(self.mh.rqlexec('Any RTN, O WHERE X name "Note", RDEF from_entity X, '
                                          'RDEF relation_type RT, RDEF ordernum O, RT name RTN'))
         self.mh.cmd_add_attribute('Note', 'whatever')
         self.failUnless('whatever' in self.schema)
         self.assertEquals(self.schema['whatever'].subjects(), ('Note',))
         self.assertEquals(self.schema['whatever'].objects(), ('Int',))
+        self.assertEquals(self.schema['Note'].default('whatever'), 2)
+        note = self.execute('Note X').get_entity(0, 0)
+        self.assertEquals(note.whatever, 2)
         orderdict2 = dict(self.mh.rqlexec('Any RTN, O WHERE X name "Note", RDEF from_entity X, '
                                           'RDEF relation_type RT, RDEF ordernum O, RT name RTN'))
         whateverorder = migrschema['whatever'].rproperty('Note', 'Int', 'order')