[CORD-1518] Add /delete endpoint to remove models

Change-Id: I2bc586730183b5f9737951970a6eed481922f2fb
diff --git a/test/test_tosca_parser_e2e.py b/test/test_tosca_parser_e2e.py
index aceec43..f09a811 100644
--- a/test/test_tosca_parser_e2e.py
+++ b/test/test_tosca_parser_e2e.py
@@ -9,6 +9,8 @@
 
 class FakeModel:
     save = None
+    delete = None
+    is_new = False
     id = 1
 
 class FakeGuiExt:
@@ -74,6 +76,42 @@
         self.assertEqual(saved_model.files, '/spa/extensions/test/vendor.js, /spa/extensions/test/app.js')
 
     @patch.dict(RESOURCES, mock_resources, clear=True)
+    @patch.object(FakeGuiExt.objects, 'filter', MagicMock(return_value=[FakeModel]))
+    @patch.object(FakeModel, 'delete')
+    def test_basic_deletion(self, mock_delete):
+        """
+        [TOSCA_Parser] Should delete models defined in a TOSCA recipe
+        """
+        recipe = """
+    tosca_definitions_version: tosca_simple_yaml_1_0
+
+    description: Persist xos-sample-gui-extension
+
+    imports:
+       - custom_types/xosguiextension.yaml
+
+    topology_template:
+      node_templates:
+
+        # UI Extension
+        test:
+          type: tosca.nodes.XOSGuiExtension
+          properties:
+            name: test
+            files: /spa/extensions/test/vendor.js, /spa/extensions/test/app.js
+    """
+
+        parser = TOSCA_Parser(recipe, USERNAME, PASSWORD, delete=True)
+
+        parser.execute()
+
+        # checking that the model has been saved
+        mock_delete.assert_called()
+
+        self.assertIsNotNone(parser.templates_by_model_name['test'])
+        self.assertEqual(parser.ordered_models_name, ['test'])
+
+    @patch.dict(RESOURCES, mock_resources, clear=True)
     @patch.object(FakeSite.objects, 'filter', MagicMock(return_value=[FakeModel]))
     @patch.object(FakeUser.objects, 'filter', MagicMock(return_value=[FakeModel]))
     @patch.object(FakeModel, 'save')