def test_source_rc_missing_installer_ip(self): with mock.patch('functest.ci.prepare_env.os.path.isfile', return_value=False), \ self.assertRaises(Exception): CONST.INSTALLER_IP = None CONST.openstack_creds = 'test_creds' prepare_env.source_rc_file()
def test_source_rc_missing_installer_type(self): with mock.patch('functest.ci.prepare_env.os.path.isfile', return_value=False), \ self.assertRaises(Exception): CONST.INSTALLER_IP = 'test_ip' CONST.openstack_creds = 'test_creds' CONST.INSTALLER_TYPE = 'test_type' opnfv_constants.INSTALLERS = [] prepare_env.source_rc_file()
def test_source_rc_missing_rc_file(self, mock_logger_warn, mock_logger_info, mock_logger_error): with mock.patch('functest.ci.prepare_env.os.path.isfile', return_value=True), \ mock.patch('functest.ci.prepare_env.os.path.getsize', return_value=0), \ self.assertRaises(Exception): CONST.openstack_creds = 'test_creds' prepare_env.source_rc_file()
def test_source_rc_missing_os_credfile_ci_inst(self): with mock.patch('functest.ci.prepare_env.os.path.isfile', return_value=False), \ mock.patch('functest.ci.prepare_env.os.path.getsize'), \ mock.patch('functest.ci.prepare_env.os.path.join'), \ mock.patch('functest.ci.prepare_env.subprocess.Popen') \ as mock_subproc_popen, \ self.assertRaises(Exception): CONST.openstack_creds = 'test_creds' CONST.INSTALLER_IP = None CONST.INSTALLER_TYPE = 'test_type' opnfv_constants.INSTALLERS = ['test_type'] process_mock = mock.Mock() attrs = {'communicate.return_value': ('output', 'error'), 'return_code': 1} process_mock.configure_mock(**attrs) mock_subproc_popen.return_value = process_mock prepare_env.source_rc_file()