def test_execute_fail(self, _, __): with self.assertRaises(errors.CheckBeforeDeploymentError) as cm: CheckRepositoryConnectionFromMasterNodeTask.execute(self.task) self.assertEqual( cm.exception.message, 'Connection to following repositories could not be established: ' '<url1 [500]>')
def test_execute_fail(self, get_mock): response_mock = mock.Mock() response_mock.status_code = 500 response_mock.url = self.url get_mock.return_value = response_mock with self.assertRaises(errors.CheckBeforeDeploymentError): CheckRepositoryConnectionFromMasterNodeTask.execute(self.task)
def test_execute_success(self, get_mock): response_mock = mock.Mock() response_mock.status_code = 200 response_mock.url = self.url get_mock.return_value = response_mock CheckRepositoryConnectionFromMasterNodeTask.execute(self.task) self.mrepos.assert_called_with(self.task.cluster)
def test_execute_fail_with_connection_error(self, m_exception, _, __): with self.assertRaises(errors.CheckBeforeDeploymentError) as cm: CheckRepositoryConnectionFromMasterNodeTask.execute(self.task) m_exception.assert_called_once_with( "Connection to the repositories could not be established: %s.", self._connection_error) self.assertEqual( cm.exception.message, "Connection to the repositories could not be " "established. Please refer to the Fuel Master " "web backend logs for more details.")
def test_execute_success_on_retry(self, _, __): CheckRepositoryConnectionFromMasterNodeTask.execute(self.task) self.mrepos.assert_called_with(self.task.cluster)