def test_start_build(self, mock_runtests, mock_docker_stop, mock_docker_start): start_build({ 'id': 1, }, {'docker_image': 'frigg/frigg-test-base:latest', 'hq_token': 'test_token', 'hq_url': 'url'}) self.assertTrue(mock_runtests.called) self.assertTrue(mock_docker_start.called) self.assertTrue(mock_docker_stop.called)
def test_start_build(self, mock_run_tests, mock_docker): start_build({ 'id': 1, 'gh_token': 'a-token-one-might-say', 'image': 'frigg/frigg-test-base' }, { 'hq_token': 'test_token', 'hq_url': 'url' }) self.assertTrue(mock_run_tests.called) mock_docker.assert_called_once_with( privilege=True, combine_outputs=True, image='frigg/frigg-test-base', name_prefix='build', env_variables={'CI': 'frigg', 'GH_TOKEN': 'a-token-one-might-say'} )
def test_start_build(self, mock_run_tests, mock_docker, mock_env_variables): start_build({ 'id': 1, 'gh_token': 'a-token-one-might-say', 'image': 'frigg/frigg-test-base', 'branch': 'master', 'sha': 'hash' }, { 'hq_token': 'test_token', 'hq_url': 'url' }) assert mock_run_tests.called assert mock_env_variables.called mock_docker.assert_called_once_with( privilege=True, combine_outputs=True, image='frigg/frigg-test-base', name_prefix='build', env_variables={'FRIGG_CI': 'true'} )
def test_should_mark_non_existing_commit_as_error(mocker, task, build_options): mocker.patch('frigg_worker.api.APIWrapper.report_run') task.update({'sha': '0000000000000000000000000000000000000000'}) build = start_build(task, build_options) assert build is not None assert build.errored
def test_should_build_latest_frigg_worker(mocker, task, latest_commit, build_options): mocker.patch('frigg_worker.api.APIWrapper.report_run') task.update({'sha': latest_commit}) build = start_build(task, build_options) assert build is not None assert len(build.results.keys()) != 0