[CORD-2671] Adding test for Django relations

Change-Id: I438746fbbcb51762c2809cd94710dc3a2f4c90db
diff --git a/lib/xos-genx/xos-genx-tests/test_django_generator.py b/lib/xos-genx/xos-genx-tests/test_django_generator.py
index 914c4a3..8567d2a 100644
--- a/lib/xos-genx/xos-genx-tests/test_django_generator.py
+++ b/lib/xos-genx/xos-genx-tests/test_django_generator.py
@@ -37,6 +37,42 @@
         links = filter(lambda s:'Key(' in s, output.splitlines())
         self.assertEqual(len(links), 2)
 
+    def test_optional_relations(self):
+        """
+        [XOS-GenX] Generate DJANGO models, verify relations
+        """
+        xproto = \
+            """
+            option app_label = "test";
+
+            message ENodeB {
+            }
+            
+            message Handover {
+            }
+
+            message Foo {
+                optional manytoone enodeb->ENodeB:profiles = 1 [null = True, blank = True];
+                required manytoone handover->Handover:profiles = 2 [null = False, blank = False];
+            }
+            """
+
+        args = FakeArgs()
+        args.inputs = xproto
+        args.target = 'django.xtarget'
+        output = XOSGenerator.generate(args)
+
+        null_true = filter(lambda s: 'null = True' in s, output.splitlines())
+        null_false = filter(lambda s: 'null = False' in s, output.splitlines())
+
+        blank_true = filter(lambda s: 'blank = True' in s, output.splitlines())
+        blank_false = filter(lambda s: 'blank = False' in s, output.splitlines())
+
+        self.assertEqual(len(null_true), 1)
+        self.assertEqual(len(null_false), 1)
+        self.assertEqual(len(blank_true), 1)
+        self.assertEqual(len(blank_false), 1)
+
 if __name__ == '__main__':
     unittest.main()