+
+def test_flask_delete(mock_flask_uow):
+ session, app = mock_flask_uow
+ apibase = config.get_o2ims_api_base() + '/v1'
+
+ with app.test_client() as client:
+ session.return_value.execute.return_value.first.return_value = {}
+
+ subscription_id1 = str(uuid.uuid4())
+ resp = client.delete(apibase+"/subscriptions/"+subscription_id1)
+ assert resp.status_code == 200
+
+
+def test_flask_not_allowed(mock_flask_uow):
+ _, app = mock_flask_uow
+ apibase = config.get_o2ims_api_base() + '/v1'
+
+ with app.test_client() as client:
+ # Testing resource type not support method
+ ##########################
+ uri = apibase + "/resourceTypes"
+ resp = client.post(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.put(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.patch(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.delete(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+
+ resource_type_id1 = str(uuid.uuid4())
+ uri = apibase + "/resourceTypes/" + resource_type_id1
+ resp = client.post(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.put(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.patch(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.delete(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+
+ # Testing resource pool not support method
+ ##########################
+ uri = apibase + "/resourcePools"
+ resp = client.post(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.put(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.patch(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.delete(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+
+ resource_pool_id1 = str(uuid.uuid4())
+ uri = apibase + "/resourcePools/" + resource_pool_id1
+ resp = client.post(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.put(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.patch(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.delete(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+
+ # Testing resource not support method
+ ##########################
+ uri = apibase + "/resourcePools/" + resource_pool_id1 + "/resources"
+ resp = client.post(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.put(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.patch(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.delete(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+
+ resource_id1 = str(uuid.uuid4())
+ uri = apibase + "/resourcePools/" + \
+ resource_pool_id1 + "/resources/" + resource_id1
+ resp = client.post(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.put(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.patch(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.delete(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+
+ # Testing deployment managers not support method
+ ##########################
+ uri = apibase + "/deploymentManagers"
+ resp = client.post(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.put(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.patch(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.delete(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+
+ deployment_manager_id1 = str(uuid.uuid4())
+ uri = apibase + "/deploymentManagers/" + deployment_manager_id1
+ resp = client.post(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.put(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.patch(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.delete(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+
+ # Testing subscriptions not support method
+ ##########################
+ uri = apibase + "/subscriptions"
+ resp = client.put(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.patch(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.delete(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+
+ subscription_id1 = str(uuid.uuid4())
+ uri = apibase + "/subscriptions/" + subscription_id1
+ resp = client.post(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.put(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'
+ resp = client.patch(uri)
+ assert resp.status == '405 METHOD NOT ALLOWED'