def test_get_network_rules(self, gatherfacts_module_mock):
     network_rules = MockGatherfactsApi.get_network_rules_response('api')
     self.get_module_args.update({
         'gather_subset': ['network_rules']
     })
     gatherfacts_module_mock.module.params = self.get_module_args
     gatherfacts_module_mock.network_api.get_network_rules = MagicMock(return_value=MockSDKResponse(network_rules))
     gatherfacts_module_mock.perform_module_operation()
     assert MockGatherfactsApi.get_network_rules_response('module') == gatherfacts_module_mock.module.exit_json.call_args[1]['NetworkRules']
 def test_get_network_rules_api_exception(self, gatherfacts_module_mock):
     self.get_module_args.update({
         'gather_subset': ['network_rules']
     })
     gatherfacts_module_mock.module.params = self.get_module_args
     gatherfacts_module_mock.network_api.get_network_rules = MagicMock(side_effect=MockApiException)
     gatherfacts_module_mock.perform_module_operation()
     assert MockGatherfactsApi.get_network_rules_response('error') == gatherfacts_module_mock.module.fail_json.call_args[1]['msg']