Ejemplo n.º 1
0
    def test_build_project_for_target(self):
        compilation_service = mock.MagicMock()
        recipe = mock.MagicMock()

        result = build_project(compilation_service, target='raspberrypi4:64')

        assert result.status_code == 0
        compilation_service.build.assert_called_once_with('raspberrypi4:64')
Ejemplo n.º 2
0
    def test_build_project_for_host(self):
        compilation_service = mock.MagicMock()
        recipe = mock.MagicMock()

        result = build_project(compilation_service, recipe)

        assert result.status_code == 0
        compilation_service.build.assert_called_once_with(recipe)
Ejemplo n.º 3
0
    def test_build_fails_when_docker_image_is_not_found(self):
        recipe = mock.MagicMock()
        compilation_service = mock.MagicMock()
        compilation_service.build.side_effect = DockerImageNotFound('')

        result = build_project(compilation_service, recipe)

        assert result.status_code == 1
        compilation_service.build.assert_called_once_with(recipe)
Ejemplo n.º 4
0
    def test_build_fails_when_target_is_unknown(self):
        recipe = mock.MagicMock()
        compilation_service = mock.MagicMock()
        compilation_service.build.side_effect = InvalidTarget()

        result = build_project(compilation_service, recipe)

        assert result.status_code == 1
        compilation_service.build.assert_called_once_with(recipe)
Ejemplo n.º 5
0
    def test_build_fails_when_compilation_fails(self):
        recipe = mock.MagicMock()
        compilation_service = mock.MagicMock()
        compilation_service.build.side_effect = BuildError()

        result = build_project(compilation_service, recipe)

        assert result.status_code == 1
        compilation_service.build.assert_called_once_with(recipe)
Ejemplo n.º 6
0
    def test_build_fails_when_current_directory_is_not_a_chromos_project(self):
        recipe = mock.MagicMock()
        compilation_service = mock.MagicMock()
        compilation_service.build.side_effect = ProjectDescriptorNotFound()

        result = build_project(compilation_service, recipe)

        assert result.status_code == 1
        compilation_service.build.assert_called_once_with(recipe)