コード例 #1
0
    def test_simple(self, get_implementation):
        implementation = mock.Mock()
        get_implementation.return_value = implementation

        sync_artifact(artifact_id=self.artifact.id.hex)

        implementation.fetch_artifact.assert_called_once_with(
            artifact=self.artifact, )
コード例 #2
0
    def test_file_doesnt_exist(self, get_implementation):
        implementation = mock.Mock()
        get_implementation.return_value = implementation

        with mock.patch.object(sync_artifact, 'allow_absent_from_db', True):
            sync_artifact(artifact_id=self.artifact.id.hex)

        implementation.fetch_artifact.assert_called_once_with(
            artifact=self.artifact, )
コード例 #3
0
ファイル: test_sync_artifact.py プロジェクト: alex/changes
    def test_simple(self, get_implementation):
        implementation = mock.Mock()
        get_implementation.return_value = implementation

        sync_artifact(artifact_id=self.artifact.id.hex)

        implementation.fetch_artifact.assert_called_once_with(
            artifact=self.artifact,
        )
コード例 #4
0
ファイル: test_sync_artifact.py プロジェクト: dropbox/changes
    def test_file_doesnt_exist(self, get_implementation):
        implementation = mock.Mock()
        get_implementation.return_value = implementation

        with mock.patch.object(sync_artifact, 'allow_absent_from_db', True):
            sync_artifact(artifact_id=self.artifact.id.hex)

        implementation.fetch_artifact.assert_called_once_with(
            artifact=self.artifact,
        )
コード例 #5
0
    def test_legacy(self, get_implementation):
        implementation = mock.Mock()
        get_implementation.return_value = implementation

        sync_artifact(step_id=self.jobstep.id.hex, artifact=self.artifact.data)

        implementation.fetch_artifact.assert_called_once_with(
            step=self.jobstep,
            artifact=self.artifact.data,
        )
コード例 #6
0
ファイル: test_sync_artifact.py プロジェクト: dropbox/changes
    def test_file_exists(self, get_implementation):
        implementation = mock.Mock()
        get_implementation.return_value = implementation
        manager = mock.Mock()
        implementation.get_artifact_manager.return_value = manager

        self.artifact.file.save(StringIO(), 'foo')
        db.session.add(self.artifact)
        db.session.commit()

        with mock.patch.object(sync_artifact, 'allow_absent_from_db', True):
            sync_artifact(artifact_id=self.artifact.id.hex)

        implementation.get_artifact_manager.assert_called_once_with(self.jobstep)
        manager.process.assert_called_once_with(self.artifact)
コード例 #7
0
    def test_file_exists(self, get_implementation):
        implementation = mock.Mock()
        get_implementation.return_value = implementation
        manager = mock.Mock()
        implementation.get_artifact_manager.return_value = manager

        self.artifact.file.save(StringIO(), 'foo')
        db.session.add(self.artifact)
        db.session.commit()

        with mock.patch.object(sync_artifact, 'allow_absent_from_db', True):
            sync_artifact(artifact_id=self.artifact.id.hex)

        implementation.get_artifact_manager.assert_called_once_with(
            self.jobstep)
        manager.process.assert_called_once_with(self.artifact)