|
@@ -0,0 +1,39 @@
|
|
1
|
+import unittest
|
|
2
|
+
|
|
3
|
+import tests.loader_utils
|
|
4
|
+from tests.leapi.query.utils import dyncode_module as dyncode
|
|
5
|
+
|
|
6
|
+from lodel.leapi.leobject import LeApiDataCheckError
|
|
7
|
+from lodel.leapi.query import LeDeleteQuery, LeUpdateQuery, LeGetQuery
|
|
8
|
+from lodel.leapi.exceptions import *
|
|
9
|
+
|
|
10
|
+class LeFilteredQueryTestCase(unittest.TestCase):
|
|
11
|
+
|
|
12
|
+ q_classes = [ LeDeleteQuery, LeUpdateQuery, LeGetQuery ]
|
|
13
|
+
|
|
14
|
+ def test_init(self):
|
|
15
|
+ """ Testing LeObject child class __init__ """
|
|
16
|
+ dyncode.Person(
|
|
17
|
+ lodel_id = '1',
|
|
18
|
+ lastname = "Foo",
|
|
19
|
+ firstname = "Bar",
|
|
20
|
+ alias = "Foobar")
|
|
21
|
+
|
|
22
|
+ def test_init_abstract(self):
|
|
23
|
+ """ Testing init abstract LeObject childs """
|
|
24
|
+ abstract_classes = [
|
|
25
|
+ dyncode.Entitie, dyncode.Indexabs]
|
|
26
|
+ for cls in abstract_classes:
|
|
27
|
+ with self.assertRaises(NotImplementedError):
|
|
28
|
+ cls(lodel_id = 1)
|
|
29
|
+
|
|
30
|
+ def test_init_bad_fields(self):
|
|
31
|
+ """ Testing init with bad arguments """
|
|
32
|
+ with self.assertRaises(LeApiErrors):
|
|
33
|
+ dyncode.Person(
|
|
34
|
+ lodel_id = 1,
|
|
35
|
+ foobar = "barfoo")
|
|
36
|
+ with self.assertRaises(LeApiErrors):
|
|
37
|
+ dyncode.Person(lastname = "foo", firstname = "bar")
|
|
38
|
+
|
|
39
|
+
|