Skip to content

Commit

Permalink
update test to utilize SingerWriter class
Browse files Browse the repository at this point in the history
  • Loading branch information
BuzzCutNorman committed Nov 20, 2023
1 parent 01cecaf commit ea8f7e8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/_singerlib/test_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pytz import timezone

import singer_sdk._singerlib as singer
from singer_sdk._singerlib.messages import format_message
from singer_sdk.io_base import SingerWriter

UTC = datetime.timezone.utc

Expand All @@ -19,22 +19,24 @@ def test_exclude_null_dict():


def test_format_message():
singerwriter = SingerWriter()
message = singer.RecordMessage(
stream="test",
record={"id": 1, "name": "test"},
)
assert format_message(message) == (
assert singerwriter.format_message(message) == (
'{"type": "RECORD", "stream": "test", "record": {"id": 1, "name": "test"}}'
)


def test_write_message():
singerwriter = SingerWriter()
message = singer.RecordMessage(
stream="test",
record={"id": 1, "name": "test"},
)
with redirect_stdout(io.StringIO()) as out:
singer.write_message(message)
singerwriter.write_message(message)

assert out.getvalue() == (
'{"type": "RECORD", "stream": "test", "record": {"id": 1, "name": "test"}}\n'
Expand Down

0 comments on commit ea8f7e8

Please sign in to comment.