SEBA-394 More unit tests for orm
Change-Id: I1665d6ca23acf924b7defc7ec07179384b6b3d72
diff --git a/xos/xos_client/xosapi/fake_stub.py b/xos/xos_client/xosapi/fake_stub.py
index 13d684d..406e8a7 100644
--- a/xos/xos_client/xosapi/fake_stub.py
+++ b/xos/xos_client/xosapi/fake_stub.py
@@ -315,6 +315,8 @@
class TestModel(FakeObj):
FIELDS = ( {"name": "id", "default": 0},
{"name": "intfield", "default": 0},
+ {"name": "stringfield", "default": "somestring"},
+ {"name": "testmodeltwos_ids", "default": [], "fk_reverse": "TestModelTwo"},
{"name": "class_names", "default": "TestModel"} )
def __init__(self, **kwargs):
@@ -322,6 +324,18 @@
DESCRIPTOR = FakeDescriptor("TestModel")
+class TestModelTwo(FakeObj):
+ FIELDS = ( {"name": "id", "default": 0},
+ {"name": "intfieldtwo", "default": 0},
+ {"name": "stringfieldtwo", "default": "somestringtwo"},
+ {"name": "testmodel_id", "default": 0, "fk_model": "TestModel", "fk_reverseFieldName": "testmodeltwos"},
+ {"name": "class_names", "default": "TestModel"})
+
+ def __init__(self, **kwargs):
+ return super(TestModelTwo, self).__init__(self.FIELDS, **kwargs)
+
+ DESCRIPTOR = FakeDescriptor("TestModelTwo")
+
class ID(FakeObj):
pass
@@ -370,7 +384,7 @@
self.deleted_objs = {}
for name in ["Controller", "Deployment", "Slice", "Site", "Tag", "Service", "ServiceInstance", "ONOSService",
"User", "Network", "NetworkTemplate", "ControllerNetwork", "NetworkSlice",
- "TestModel"]:
+ "TestModel", "TestModelTwo"]:
setattr(self, "Get%s" % name, functools.partial(self.get, name))
setattr(self, "List%s" % name, functools.partial(self.list, name))
setattr(self, "Create%s" % name, functools.partial(self.create, name))
@@ -453,7 +467,7 @@
def __init__(self):
for name in ["Controller", "Deployment", "Slice", "Site", "ID", "Tag", "Service", "ServiceInstance",
"ONOSService", "User", "Network", "NetworkTemplate", "ControllerNetwork", "NetworkSlice",
- "TestModel"]:
+ "TestModel", "TestModelTwo"]:
setattr(self, name, globals()[name])
self.common__pb2 = FakeCommonProtos()
@@ -462,7 +476,7 @@
self._classes = {}
for name in ["Controller", "Deployment", "Slice", "Site", "ID", "Tag", "Service", "ServiceInstance",
"ONOSService", "User", "Network", "NetworkTemplate", "ControllerNetwork", "NetworkSlice",
- "TestModel"]:
+ "TestModel", "TestModelTwo"]:
self._classes["xos.%s" % name] = globals()[name]