Exemplo n.º 1
0
    def test_get_build_history(self, mocked_upload_log, mocked_cloud_build,
                               mocked_google_auth):
        """Test for get_build_steps."""
        del mocked_cloud_build, mocked_google_auth
        mocked_upload_log.return_value = True
        builds = [{
            'build_id': '1',
            'finishTime': 'test_time',
            'status': 'SUCCESS'
        }]
        mocked_get_build = MockGetBuild(builds)
        update_build_status.get_build = mocked_get_build.get_build

        expected_projects = {
            'history': [{
                'build_id': '1',
                'finish_time': 'test_time',
                'success': True
            }],
            'last_successful_build': {
                'build_id': '1',
                'finish_time': 'test_time'
            }
        }
        self.assertDictEqual(update_build_status.get_build_history(['1']),
                             expected_projects)
Exemplo n.º 2
0
    def test_get_build_history_no_last_success(self, mocked_upload_log,
                                               mocked_cloud_build,
                                               mocked_google_auth):
        """Test when there is no last successful build."""
        del mocked_cloud_build, mocked_google_auth
        builds = [{
            'build_id': '1',
            'finishTime': 'test_time',
            'status': 'FAILURE'
        }]
        mocked_get_build = MockGetBuild(builds)
        update_build_status.get_build = mocked_get_build.get_build
        mocked_upload_log.return_value = True

        expected_projects = {
            'history': [{
                'build_id': '1',
                'finish_time': 'test_time',
                'success': False
            }]
        }
        self.assertDictEqual(update_build_status.get_build_history(['1']),
                             expected_projects)