def test_check_env_variables_with_ci_debug(self, mock_logger_warn, mock_logger_info): CONST.CI_DEBUG = mock.Mock() prepare_env.check_env_variables() mock_logger_info.assert_any_call("Checking environment variables" "...") mock_logger_info.assert_any_call( test_utils.SubstrMatch(" CI_DEBUG="))
def test_check_env_variables_with_inst_ip(self, mock_logger_warn, mock_logger_info): CONST.INSTALLER_IP = mock.Mock() prepare_env.check_env_variables() mock_logger_info.assert_any_call("Checking environment variables" "...") mock_logger_info.assert_any_call( test_utils.SubstrMatch(" INSTALLER_IP="))
def test_check_env_variables_with_scenario(self, mock_logger_warn, mock_logger_info): CONST.DEPLOY_SCENARIO = 'test_scenario' prepare_env.check_env_variables() mock_logger_info.assert_any_call("Checking environment variables" "...") mock_logger_info.assert_any_call( test_utils.SubstrMatch("DEPLOY_SCENARIO="))
def test_check_env_variables_with_node(self, mock_logger_warn, mock_logger_info): CONST.NODE_NAME = mock.Mock() prepare_env.check_env_variables() mock_logger_info.assert_any_call("Checking environment variables" "...") mock_logger_info.assert_any_call( test_utils.SubstrMatch(" NODE_NAME="))
def test_check_env_variables_with_is_ci_run(self, mock_logger_warn, mock_logger_info): CONST.IS_CI_RUN = mock.Mock() prepare_env.check_env_variables() mock_logger_info.assert_any_call("Checking environment variables" "...") mock_logger_info.assert_any_call( test_utils.SubstrMatch(" IS_CI_RUN="))
def test_check_env_variables_with_build_tag(self, mock_logger_warn, mock_logger_info): CONST.BUILD_TAG = mock.Mock() prepare_env.check_env_variables() mock_logger_info.assert_any_call("Checking environment variables" "...") mock_logger_info.assert_any_call( test_utils.SubstrMatch(" BUILD_TAG="))
def test_list_sfcs_exception(self, mock_logger_error): with mock.patch.object(self.tacker_client, 'list_sfcs', side_effect=Exception): resp = openstack_tacker.list_sfcs(self.tacker_client, verbose=False) mock_logger_error.assert_called_once_with( test_utils.SubstrMatch("Error" " [list" "_sfcs(" "tacker_" "client)]:")) self.assertIsNone(resp)
def test_create_vnfd_exception(self, mock_logger_error): with mock.patch.object(self.tacker_client, 'create_vnfd', side_effect=Exception): resp = openstack_tacker.create_vnfd(self.tacker_client, tosca_file=self.tosca_file) mock_logger_error.assert_called_once_with( test_utils.SubstrMatch("Error" " [create" "_vnfd(" "tacker_" "client, " "'%s')]" % self.tosca_file)) self.assertIsNone(resp)
def test_create_sfc_exception(self, mock_logger_error): with mock.patch.object(self.tacker_client, 'create_sfc', side_effect=Exception): resp = openstack_tacker.create_sfc(self.tacker_client, sfc_name=self.sfc, chain_vnf_ids=['chain_vnf_id'], chain_vnf_names=[self.vnf]) mock_logger_error.assert_called_once_with( test_utils.SubstrMatch("error" " [create" "_sfc(" "tacker_" "client")) self.assertIsNone(resp)
def test_create_vnf_exception(self, mock_logger_error): with mock.patch.object(self.tacker_client, 'create_vnf', side_effect=Exception): resp = openstack_tacker.create_vnf(self.tacker_client, vnf_name=self.vnf, vnfd_id='vnfd_id', vnfd_name=self.vnfd) mock_logger_error.assert_called_once_with( test_utils.SubstrMatch("error" " [create" "_vnf(" "tacker_" "client")) self.assertIsNone(resp)
def test_get_id_from_name_exception(self, mock_logger_error): with mock.patch.object(self.tacker_client, 'get', side_effect=Exception): resp = openstack_tacker.get_id_from_name(self.tacker_client, self.resource_type, self.resource_name) self.assertIsNone(resp) mock_logger_error.assert_called_once_with( test_utils.SubstrMatch("Error [get" "_id_from_" "name(tacker" "_client" ", resource_" "type, " "resource_" "name)]:"))
def test_sfc_classifier_exception(self, mock_logger_error): with mock.patch.object(self.tacker_client, 'create_sfc_classifier', side_effect=Exception): cl = self.sfc_clf resp = openstack_tacker.create_sfc_classifier(self.tacker_client, sfc_clf_name=cl, sfc_id='sfc_id', sfc_name=self.sfc) mock_logger_error.assert_called_once_with( test_utils.SubstrMatch("error" " [create" "_sfc_cl" "assifier(" "tacker_" "client")) self.assertIsNone(resp)
def test_main_with_scenario(self, mock_method): CONST.DEPLOY_SCENARIO = 'test_scenario' gen_report.main() mock_method.assert_called_once_with(test_utils.SubstrMatch('SCENARIO'))
def test_main_with_ci_loop(self, mock_method): CONST.CI_LOOP = 'daily' gen_report.main() mock_method.assert_called_once_with(test_utils.SubstrMatch('CI LOOP'))
def test_main_with_ci_run(self, mock_method): CONST.IS_CI_RUN = True gen_report.main() mock_method.assert_called_once_with(test_utils.SubstrMatch('URL'))