X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=lcm%2Flcm%2Fsamples%2Ftests.py;h=896a331572ae47cc7c264783f3598c3623b6d226;hb=46ad7c172411214c5432ed93fda4271288077447;hp=a1d13be42e473138683e6e3d6a570fa4e12f39a2;hpb=86af279acebf863b46693e8ba0f2f43013b2b66e;p=vfc%2Fgvnfm%2Fvnflcm.git diff --git a/lcm/lcm/samples/tests.py b/lcm/lcm/samples/tests.py index a1d13be4..896a3315 100644 --- a/lcm/lcm/samples/tests.py +++ b/lcm/lcm/samples/tests.py @@ -40,10 +40,11 @@ inst_res_data = { "cpu_architecture": "generic" }, }, - "virtual_storage": { + "virtual_storages": [{ + "virtual_storage_id": "volume_storage1", "type_of_storage": "root", - "size_of_storage": "40 GB" - }, + "size_of_storage": "\"40 GB\"" + }], "artifacts": [ { "artifact_name": "sw_image", @@ -95,7 +96,7 @@ inst_res_data = { "vduInfo": [ { "vduName": "VDU_vbng_0", - "flavorName": "flavor_1", + "flavorId": "12345", "directive": "", }, ] @@ -112,11 +113,11 @@ inst_res_data = { "volume_storage_id": "volume_storage1", "description": "", "properties": { - "size": "100 GB", + "size_of_storage": "\"100 GB\"", "volume_id": "", "volume_name": "volumeStorage1", "custom_volume_type": "type1", - "disk_type": "data", + "type_of_storage": "root", "delete_on_termination_vm": True, "location_info": { "vimid": "f1e33529-4a88-4155-9d7a-893cf2c80527", @@ -136,7 +137,7 @@ inst_res_data = { "local_storage_id": "omp_local_disk1", "description": "", "properties": { - "size": "100 GB", + "size": "\"100 GB\"", "disk_type": "root", }, } @@ -231,7 +232,7 @@ inst_res_data = { "virtual_network_interface_requirements": [ { "network_interface_requirements": { - "interfaceType": '{"schema-version": "0", "schema-location":"", "platform-id": "generic", "mandatory": false, "configuration-value": "SR-IOV"}' + "interfaceType": '{"schemaVersion": "0", "schemaLocation":"", "platformId": "generic", "mandatory": false, "configurationValue": "SR-IOV"}' }, "support_mandatory": False, "name": "sriov-support", @@ -321,15 +322,6 @@ c5_data_create_flavor = { "id": "6456", } -c5_data_get_flavor = { - "flavor": [ - { - "flavor-id": "111111", - "flavor-name": "flavor_1", - } - ] -} - c6_data_list_image = { "images": [ { @@ -372,8 +364,7 @@ class SampleViewTest(unittest.TestCase): r2_data_create_network = [0, json.JSONEncoder().encode(c2_data_create_network), '200'] r3_data_create_subnet = [0, json.JSONEncoder().encode(c3_data_create_subnet), '200'] r4_data_create_port = [0, json.JSONEncoder().encode(c4_data_create_port), '200'] - r5_data_get_flavor = [0, json.JSONEncoder().encode(c5_data_get_flavor), '200'] - r5_data_create_flavor = [0, json.JSONEncoder().encode(c5_data_create_flavor), '200'] + # r5_data_create_flavor = [0, json.JSONEncoder().encode(c5_data_create_flavor), '200'] r6_data_list_image = [0, json.JSONEncoder().encode(c6_data_list_image), '200'] r6_data_create_vm = [0, json.JSONEncoder().encode(c6_data_create_vm), '200'] r6_data_get_vm = [0, json.JSONEncoder().encode(c6_data_get_vm), '200'] @@ -383,10 +374,9 @@ class SampleViewTest(unittest.TestCase): r2_data_create_network, r3_data_create_subnet, r4_data_create_port, - r5_data_get_flavor, r5_data_create_flavor, r6_data_list_image, r6_data_create_vm, r6_data_get_vm] resp = self.client.post(inst_res_url, data=json.dumps(inst_res_data), content_type='application/json') - self.failUnlessEqual(status.HTTP_204_NO_CONTENT, resp.status_code) + self.assertEqual(status.HTTP_204_NO_CONTENT, resp.status_code) @mock.patch.object(restcall, 'call_req') def test_term_res(self, mock_call_req): @@ -399,4 +389,18 @@ class SampleViewTest(unittest.TestCase): r0_data_delete, r0_data_delete] resp = self.client.post(term_res_url, data=json.dumps(term_res_data), content_type='application/json') - self.failUnlessEqual(status.HTTP_204_NO_CONTENT, resp.status_code) + self.assertEqual(status.HTTP_204_NO_CONTENT, resp.status_code) + + +class HealthCheckViewTest(unittest.TestCase): + def setUp(self): + self.client = APIClient() + + def tearDown(self): + pass + + def test_health_check(self): + response = self.client.get("/api/vnflcm/v1/health_check") + self.assertEqual(status.HTTP_200_OK, response.status_code, response.content) + resp_data = json.loads(response.content) + self.assertEqual({"status": "active"}, resp_data)