Skip to content

Commit

Permalink
udpate unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
leslievandemark committed Dec 11, 2024
1 parent c0e835e commit d14a435
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions tests/unittests/test_get_streams_and_state_translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ class TestTranslateState(unittest.TestCase):
def test_newer_format_state_with_repo_name(self):
"""Verify that `translate_state` return the state itself if a newer format bookmark is found."""
state = {
"bookmarks": {
"org/test-repo" : {
"comments": {"since": "2019-01-01T00:00:00Z"}
"bookmarks" : {
"comments" : {
"org/test-repo": {"since": "2019-01-01T00:00:00Z"},
},
"org/test-repo2" : {}
}
}

Expand All @@ -47,11 +46,6 @@ def test_newer_format_state_with_repo_name(self):
def test_older_format_state_without_repo_name(self):
"""Verify that `translate_state` migrate each stream's bookmark into the repo name"""
older_format_state = {
"bookmarks": {
"comments": {"since": "2019-01-01T00:00:00Z"}
}
}
expected_state = {
"bookmarks": {
"org/test-repo" : {
"comments": {"since": "2019-01-01T00:00:00Z"}
Expand All @@ -61,6 +55,12 @@ def test_older_format_state_without_repo_name(self):
}
}
}
expected_state = {
"bookmarks": {
"comments": {"org/test-repo" : {"since": "2019-01-01T00:00:00Z"},
"org/test-repo2" : {"since": "2019-01-01T00:00:00Z"}},
}
}
final_state = translate_state(older_format_state, self.catalog, ["org/test-repo", "org/test-repo2"])
self.assertEqual(expected_state, dict(final_state))

Expand All @@ -75,10 +75,9 @@ def test_state_with_no_previous_repo_name_newer_format_bookmark(self):
"""Verify that `translate_state` return the existing state if all existing repo unselected in the current sync."""
newer_format_state = {
"bookmarks": {
"org/test-repo" : {
"comments": {"since": "2019-01-01T00:00:00Z"}
"comments" : {
"org/test-repo": {"since": "2019-01-01T00:00:00Z"}
},
"org/test-repo2" : {}
}
}
final_state = translate_state(newer_format_state, self.catalog, ["org/test-repo3", "org/test-repo4"])
Expand All @@ -88,17 +87,16 @@ def test_state_with_no_previous_repo_name_old_format_bookmark(self):
"""Verify that `translate_state` migrate each stream's bookmark into the repo name"""
older_format_state = {
"bookmarks": {
"comments": {"since": "2019-01-01T00:00:00Z"}
"org/test-repo3": {
"comments": {"since": "2019-01-01T00:00:00Z"}
}
}
}
expected_state = {
"bookmarks": {
"org/test-repo3" : {
"comments": {"since": "2019-01-01T00:00:00Z"}
},
"org/test-repo4" : {
"comments": {"since": "2019-01-01T00:00:00Z"}
}
"comments" : {
"org/test-repo3": {"since": "2019-01-01T00:00:00Z"},
},
}
}
final_state = translate_state(older_format_state, self.catalog, ["org/test-repo3", "org/test-repo4"])
Expand Down

0 comments on commit d14a435

Please sign in to comment.