[CORD-2068] [CORD-2069] [CORD-2070] [CORD-2071] [CORD-2072] [CORD-2073]
Exposing parsing and saving errors
Change-Id: I98ded64a9d5b09a2e69e8f47242be4f775075b00
diff --git a/test/test_grpc_models_accessor.py b/test/test_grpc_models_accessor.py
index ffafaa3..3851857 100644
--- a/test/test_grpc_models_accessor.py
+++ b/test/test_grpc_models_accessor.py
@@ -120,5 +120,16 @@
mock_filter.assert_called_with(foo="bar")
mock_new.assert_called()
+ @patch.dict(RESOURCES, mock_resources, clear=True)
+ @patch.object(FakeResource.objects, "new")
+ def test_model_without_properties(self, mock_new):
+ """
+ [GRPCModelsAccessor] get_model_from_classname: should create a new model if not properties are specified
+ """
+ data = {
+ }
+ GRPCModelsAccessor.get_model_from_classname('test-model', data, USERNAME, PASSWORD)
+ mock_new.assert_called()
+
if __name__ == '__main__':
unittest.main()
\ No newline at end of file
diff --git a/test/test_tosca_generator.py b/test/test_tosca_generator.py
index 4e3ecda..0011d31 100644
--- a/test/test_tosca_generator.py
+++ b/test/test_tosca_generator.py
@@ -78,7 +78,7 @@
args.write_to_file = 'target'
args.quiet = False
output = XOSGenerator.generate(args)
- self.assertEqual(output.count("name:"), 2)
+ self.assertEqual(output.count("name:"), 4)
self.assertIn("prop:", output)
if __name__ == '__main__':
diff --git a/test/test_tosca_parser.py b/test/test_tosca_parser.py
index c8d8947..829fed0 100644
--- a/test/test_tosca_parser.py
+++ b/test/test_tosca_parser.py
@@ -175,8 +175,21 @@
python error
starting at line
38209834 of some file
+UnknownFieldError: with some message
+ followed by useless things
+ImportError: with some message
+ followed by useless things
+InvalidTypeError: with some message
+ followed by useless things
+TypeMismatchError: with some message
+ followed by useless things
""")
- self.assertEqual(e, "MissingRequiredFieldError: some message")
+ self.assertEqual(e, """MissingRequiredFieldError: some message
+UnknownFieldError: with some message
+ImportError: with some message
+InvalidTypeError: with some message
+TypeMismatchError: with some message
+""")
def test_save_recipe_to_tmp_file(self):
"""
diff --git a/test/test_tosca_parser_e2e.py b/test/test_tosca_parser_e2e.py
index 5e1f916..a4c8e29 100644
--- a/test/test_tosca_parser_e2e.py
+++ b/test/test_tosca_parser_e2e.py
@@ -220,4 +220,4 @@
with self.assertRaises(Exception) as e:
parser.execute()
- self.assertEqual(e.exception.message, "[XOS-TOSCA] Model Site:Open Networking Lab has property 'must-exist' but cannot be found")
+ self.assertEqual(e.exception.message.message, "[XOS-TOSCA] Model Site:Open Networking Lab has property 'must-exist' but cannot be found")