Exemple #1
0
def test_get_updated_state(patch_incremental_base_class):
    stream = IncrementalKyribaStream(**config())
    inputs = {
        "current_stream_state": {"updateDateTime": "2022-01-01T00:00:00Z"},
        "latest_record": {"updateDateTime": "2022-01-01T00:00:01Z"},
    }
    expected_state = {"updateDateTime": "2022-01-01T00:00:01Z"}
    assert stream.get_updated_state(**inputs) == expected_state
Exemple #2
0
def test_min_request_params(patch_incremental_base_class):
    stream = IncrementalKyribaStream(**config())
    inputs = {"stream_state": {}, "stream_slice": {}, "next_page_token": {}}
    expected = {"sort": "updateDateTime", "filter": "updateDateTime=gt='2022-01-01T00:00:00Z'"}
    assert stream.request_params(**inputs) == expected
Exemple #3
0
def test_stream_checkpoint_interval(patch_incremental_base_class):
    stream = IncrementalKyribaStream(**config())
    expected_checkpoint_interval = 100
    assert stream.state_checkpoint_interval == expected_checkpoint_interval
Exemple #4
0
def test_source_defined_cursor(patch_incremental_base_class):
    stream = IncrementalKyribaStream(**config())
    assert stream.source_defined_cursor
Exemple #5
0
def test_supports_incremental(patch_incremental_base_class, mocker):
    mocker.patch.object(IncrementalKyribaStream, "cursor_field", "dummy_field")
    stream = IncrementalKyribaStream(**config())
    assert stream.supports_incremental
Exemple #6
0
def test_stream_slices(patch_incremental_base_class):
    stream = IncrementalKyribaStream(**config())
    inputs = {"sync_mode": SyncMode.incremental, "cursor_field": [], "stream_state": {}}
    expected_stream_slice = [None]
    assert stream.stream_slices(**inputs) == expected_stream_slice
Exemple #7
0
def test_cursor_field(patch_incremental_base_class):
    stream = IncrementalKyribaStream(**config())
    expected_cursor_field = "updateDateTime"
    assert stream.cursor_field == expected_cursor_field