diff options
author | 2021-04-08 14:14:48 +0530 | |
---|---|---|
committer | 2021-04-08 14:14:48 +0530 | |
commit | 7ef613de6d9cd794fd10ae43d98ffa9312418e68 (patch) | |
tree | 7fb698b06166d0227b6dc8c04347df4c5a11ed18 /test/apps/nxi_termination/test_remote_opt_processor_termination.py | |
parent | aafb48a95fe5ace431ebe607cab660fddde8c2cc (diff) |
Update AAI query to DSL query - Slice termination
Issue-ID: OPTFRA-936
Signed-off-by: krishnaa96 <krishna.moorthy6@wipro.com>
Change-Id: I7a2bba7d23645c8bff9f503361a93fd3ac3ebc3a
Diffstat (limited to 'test/apps/nxi_termination/test_remote_opt_processor_termination.py')
-rw-r--r-- | test/apps/nxi_termination/test_remote_opt_processor_termination.py | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/test/apps/nxi_termination/test_remote_opt_processor_termination.py b/test/apps/nxi_termination/test_remote_opt_processor_termination.py index 4fa8170..9fbc27b 100644 --- a/test/apps/nxi_termination/test_remote_opt_processor_termination.py +++ b/test/apps/nxi_termination/test_remote_opt_processor_termination.py @@ -69,73 +69,74 @@ class TestRemoteOptProcessor(unittest.TestCase): exception_response_json1 = json_from_file(exception_response_file1) #nsi success scenario - self.patcher_req=patch('apps.nxi_termination.optimizers.remote_opt_processor.get_service_profiles',return_value=service_profile_json) + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', return_value=1) self.Mock_req = self.patcher_req.start() - self.assertEquals(success_output_json, process_nxi_termination_opt(request_json,osdf_config)) + self.assertEquals(success_output_json, process_nxi_termination_opt(request_json, osdf_config)) self.patcher_req.stop() #nsi failure scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_service_profiles', return_value=failure_service_profile_json) + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', return_value=3) self.Mock_req = self.patcher_req.start() self.assertEquals(nxi_failure_output_json1, process_nxi_termination_opt(request_json, osdf_config)) self.patcher_req.stop() + request_json["requestInfo"]["addtnlArgs"] = {} + #nsi success scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_service_profiles', - return_value=[]) + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', + return_value=0) self.Mock_req = self.patcher_req.start() self.assertEquals(success_output_json, process_nxi_termination_opt(request_json, osdf_config)) self.patcher_req.stop() # nsi failure scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_service_profiles', - return_value=failure_service_profile_json2) + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', + return_value=1) self.Mock_req = self.patcher_req.start() self.assertEquals(nxi_failure_output_json2, process_nxi_termination_opt(request_json, osdf_config)) self.patcher_req.stop() # # # nssi success scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_relationshiplist', return_value=success_rel_json) + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', return_value=1) self.Mock_req = self.patcher_req.start() self.assertEquals(success_output_json, process_nxi_termination_opt(nssi_request_json, osdf_config)) self.patcher_req.stop() - # nssi success scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_relationshiplist', - return_value=[]) + # nssi failure scenario + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', + return_value=2) self.Mock_req = self.patcher_req.start() - self.assertEquals(success_output_json, process_nxi_termination_opt(nssi_request_json, osdf_config)) + self.assertEquals(nssi_failure_output_json, process_nxi_termination_opt(nssi_request_json, osdf_config)) self.patcher_req.stop() - # nssi failure scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_relationshiplist', - return_value=failure_rel_json) + nssi_request_json["requestInfo"]["addtnlArgs"] = {} + + # nssi success scenario + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', + return_value=0) self.Mock_req = self.patcher_req.start() - self.assertEquals(nssi_failure_output_json, process_nxi_termination_opt(nssi_request_json, osdf_config)) + self.assertEquals(success_output_json, process_nxi_termination_opt(nssi_request_json, osdf_config)) self.patcher_req.stop() # nssi failure scenario - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_relationshiplist', - return_value=failure_rel_json2) + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', + return_value=1) self.Mock_req = self.patcher_req.start() self.assertEquals(nxi_failure_output_json2, process_nxi_termination_opt(nssi_request_json, osdf_config)) self.patcher_req.stop() - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_relationshiplist', + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', side_effect=AAIException("Error response recieved from AAI for the request")) self.Mock_req = self.patcher_req.start() - self.assertEquals(exception_response_json1, process_nxi_termination_opt(nssi_request_json, osdf_config)) + self.assertEquals("failure", process_nxi_termination_opt(nssi_request_json, osdf_config).get('requestStatus')) self.patcher_req.stop() - - self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_relationshiplist', + self.patcher_req = patch('apps.nxi_termination.optimizers.remote_opt_processor.get_resource_count', side_effect=AAIException("Request exception was encountered")) self.Mock_req = self.patcher_req.start() self.assertEquals("failure", process_nxi_termination_opt(nssi_request_json, osdf_config).get('requestStatus')) self.patcher_req.stop() - - if __name__ == "__main__": unittest.main()
\ No newline at end of file |