diff options
author | laili <lai.li@zte.com.cn> | 2018-08-24 20:04:54 +0800 |
---|---|---|
committer | laili <lai.li@zte.com.cn> | 2018-08-27 09:34:52 +0800 |
commit | 1208c9e6e845fc4f4de561db0c7f1d29af20d5a9 (patch) | |
tree | 8d6459a6254e0a4d3823ad352e2522d134ab7448 | |
parent | f4a7f60d7c14934c599bb5412434157461b096e2 (diff) |
Ns descriptor related stuffs.
Add a test to query multiple pnds.
Change-Id: I60fb15e406b555933ad724fd39c3ccddec7a0ff1
Issue-ID: VFC-1037
Signed-off-by: laili <lai.li@zte.com.cn>
-rw-r--r-- | catalog/packages/tests/test_pnf_descriptor.py | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/catalog/packages/tests/test_pnf_descriptor.py b/catalog/packages/tests/test_pnf_descriptor.py index d261968a..e5c48f1d 100644 --- a/catalog/packages/tests/test_pnf_descriptor.py +++ b/catalog/packages/tests/test_pnf_descriptor.py @@ -52,7 +52,58 @@ class TestPnfDescriptor(TestCase): self.assertEqual(expected_reponse_data, response.data) def test_query_multiple_pnfds_normal(self): - pass + expected_reponse_data = [ + { + 'id': '0', + 'pnfdId': None, + 'pnfdName': None, + 'pnfdVersion': None, + 'pnfdProvider': None, + 'pnfdInvariantId': None, + 'pnfdOnboardingState': 'CREATED', + 'onboardingFailureDetails': None, + 'pnfdUsageState': 'NOT_IN_USE', + 'userDefinedData': { + 'key1': 'value1', + 'key2': 'value2', + 'key3': 'value3', + }, + '_links': None + }, + { + 'id': '1', + 'pnfdId': None, + 'pnfdName': None, + 'pnfdVersion': None, + 'pnfdProvider': None, + 'pnfdInvariantId': None, + 'pnfdOnboardingState': 'CREATED', + 'onboardingFailureDetails': None, + 'pnfdUsageState': 'NOT_IN_USE', + 'userDefinedData': { + 'key1': 'value1', + 'key2': 'value2', + 'key3': 'value3', + }, + '_links': None + } + ] + user_defined_data = { + 'key1': 'value1', + 'key2': 'value2', + 'key3': 'value3', + } + user_defined_data = json.JSONEncoder().encode(user_defined_data) + for i in range(2): + PnfPackageModel( + pnfPackageId=str(i), + onboardingState='CREATED', + usageState='NOT_IN_USE', + userDefinedData=user_defined_data + ).save() + response = self.client.get('/api/nsd/v1/pnf_descriptors', format='json') + self.assertEqual(response.status_code, status.HTTP_200_OK) + self.assertEqual(expected_reponse_data, response.data) def test_query_single_pnfd_normal(self): expected_reponse_data = { |