Skip to content

Commit

Permalink
fixed sync test
Browse files Browse the repository at this point in the history
  • Loading branch information
toluaina committed Apr 1, 2022
1 parent 0934c6d commit 8a52865
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tests/test_sync.py
Expand Up @@ -5,7 +5,7 @@
from mock import patch

from pgsync.exc import RDSError, SchemaError
from pgsync.settings import PG_LOGICAL_SLOT_UPTO_NCHANGES
from pgsync.settings import LOGICAL_SLOT_CHUNK_SIZE
from pgsync.sync import Sync

ROW = namedtuple("Row", ["data", "xid"])
Expand All @@ -23,11 +23,13 @@ def test_logical_slot_changes(self, sync):
]
with patch("pgsync.sync.Sync.sync") as mock_sync:
sync.logical_slot_changes()
mock_peek.assert_called_with(
mock_peek.assert_any_call(
"testdb_testdb",
txmin=None,
txmax=None,
upto_nchanges=PG_LOGICAL_SLOT_UPTO_NCHANGES,
upto_nchanges=None,
limit=LOGICAL_SLOT_CHUNK_SIZE,
offset=0,
)
mock_sync.assert_not_called()

Expand All @@ -38,11 +40,13 @@ def test_logical_slot_changes(self, sync):
]
with patch("pgsync.sync.Sync.sync") as mock_sync:
sync.logical_slot_changes()
mock_peek.assert_called_with(
mock_peek.assert_any_call(
"testdb_testdb",
txmin=None,
txmax=None,
upto_nchanges=PG_LOGICAL_SLOT_UPTO_NCHANGES,
upto_nchanges=None,
limit=LOGICAL_SLOT_CHUNK_SIZE,
offset=0,
)
mock_sync.assert_not_called()

Expand All @@ -65,11 +69,13 @@ def test_logical_slot_changes(self, sync):
) as mock_get:
with patch("pgsync.sync.Sync.sync") as mock_sync:
sync.logical_slot_changes()
mock_peek.assert_called_with(
mock_peek.assert_any_call(
"testdb_testdb",
txmin=None,
txmax=None,
upto_nchanges=PG_LOGICAL_SLOT_UPTO_NCHANGES,
upto_nchanges=None,
limit=LOGICAL_SLOT_CHUNK_SIZE,
offset=0,
)
mock_get.assert_called_once()
mock_sync.assert_called_once()
Expand Down

0 comments on commit 8a52865

Please sign in to comment.