Esempio n. 1
0
    def test_second_choice(self, get_input, s3_client, local_client):
        get_input.return_value = "2"

        action_1 = SyncState(SyncState.UPDATED, 1111, 2222)
        action_2 = SyncState(SyncState.DELETED, 3333, 4444)

        result = handle_conflict("movie", action_1, s3_client, action_2,
                                 local_client)
        assert result.action == Resolution.DELETE
Esempio n. 2
0
    def test_skip(self, get_input, s3_client, local_client):
        get_input.return_value = "X"

        action_1 = SyncState(SyncState.UPDATED, 1111, 2222)
        action_2 = SyncState(SyncState.DELETED, 3333, 4444)

        result = handle_conflict("movie", action_1, s3_client, action_2,
                                 local_client)
        assert result is None
Esempio n. 3
0
    def test_diff(self, show_diff, get_input, s3_client, local_client):
        get_input.side_effect = ["d", "X"]

        action_1 = SyncState(SyncState.UPDATED, 1111, 2222)
        action_2 = SyncState(SyncState.DELETED, 3333, 4444)

        result = handle_conflict("movie", action_1, s3_client, action_2,
                                 local_client)
        assert result is None
        assert show_diff.call_count == 1
        show_diff.assert_called_with(s3_client, local_client, "movie")
Esempio n. 4
0
    def test_diff(self, show_diff, get_input, s3_client, local_client):
        get_input.side_effect = FakeInputStream([
            'd',
            'X',
        ])

        action_1 = SyncState(SyncState.UPDATED, 1111, 2222)
        action_2 = SyncState(SyncState.DELETED, 3333, 4444)

        result = handle_conflict(
            'movie',
            action_1,
            s3_client,
            action_2,
            local_client,
        )
        assert result is None
        assert show_diff.call_count == 1
        show_diff.assert_called_with(s3_client, local_client, 'movie')