Beispiel #1
0
    def test_on_idle_with_commits_and_merges(self):
        mocked_sync = MagicMock()
        mocked_syncing = MagicMock()
        mocked_commit = MagicMock()

        mocked_syncing.is_set.return_value = False

        with patch.multiple("gitfs.worker.sync",
                            syncing=mocked_syncing,
                            writers=MagicMock(value=0)):
            worker = SyncWorker("name",
                                "email",
                                "name",
                                "email",
                                strategy="strategy")
            worker.commits = "commits"
            worker.commit = mocked_commit
            worker.sync = mocked_sync

            commits = worker.on_idle()

            mocked_commit.assert_called_once_with("commits")
            assert mocked_syncing.set.call_count == 1
            assert mocked_sync.call_count == 1
            assert commits is None
Beispiel #2
0
    def test_on_idle_with_commits_and_merges(self):
        mocked_sync = MagicMock()
        mocked_syncing = MagicMock()
        mocked_commit = MagicMock()

        mocked_syncing.is_set.return_value = False

        with patch.multiple("gitfs.worker.sync", syncing=mocked_syncing,
                            writers=0):
            worker = SyncWorker("name", "email", "name", "email",
                                strategy="strategy")
            worker.commits = "commits"
            worker.commit = mocked_commit
            worker.sync = mocked_sync

            commits = worker.on_idle()

            mocked_commit.assert_called_once_with("commits")
            assert mocked_syncing.set.call_count == 1
            assert mocked_sync.call_count == 1
            assert commits is None