Browse Source

More tests on LeObject

Yann Weber 8 years ago
parent
commit
e278200414
4 changed files with 18 additions and 1 deletions
  1. 2
    0
      em_test.py
  2. BIN
      examples/em_test.pickle
  3. BIN
      tests/editorial_model.pickle
  4. 16
    1
      tests/leapi/test_leobject.py

+ 2
- 0
em_test.py View File

@@ -45,12 +45,14 @@ em_object.new_field(    'date_create',
45 45
                         group = base_group,
46 46
                         data_handler = 'datetime',
47 47
                         now_on_create = True,
48
+                        internal = True,
48 49
 )
49 50
 em_object.new_field(    'date_update',
50 51
                         display_name = 'Last update',
51 52
                         group = base_group,
52 53
                         data_handler = 'datetime',
53 54
                         now_on_update = True,
55
+                        internal = True,
54 56
 )
55 57
 
56 58
 ########################

BIN
examples/em_test.pickle View File


BIN
tests/editorial_model.pickle View File


+ 16
- 1
tests/leapi/test_leobject.py View File

@@ -36,4 +36,19 @@ class LeFilteredQueryTestCase(unittest.TestCase):
36 36
         with self.assertRaises(LeApiErrors):
37 37
             dyncode.Person(lastname = "foo", firstname = "bar")
38 38
 
39
-        
39
+    
40
+    def test_initilized(self):
41
+        """ Testing initialized method """
42
+        inst = dyncode.Person(
43
+            lodel_id = 1, lastname="foo")
44
+        self.assertFalse(inst.initialized)
45
+
46
+    def test_uid_fieldname(self):
47
+        self.assertEqual(dyncode.Person.uid_fieldname(), ["lodel_id"])
48
+
49
+    def test_fieldnames_accessor(self):
50
+        """ Testing fieldnames() accessor method """
51
+        fnames = dyncode.Person.fieldnames(False)
52
+        self.assertEqual(set(fnames),
53
+            {'lastname', 'linked_texts', 'firstname', 'alias'})
54
+

Loading…
Cancel
Save