This repository has been archived by the owner on Sep 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b86a4c1
commit e1c6f7b
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from datetime import datetime, timedelta, timezone | ||
|
||
from singer.catalog import CatalogEntry | ||
from singer.schema import Schema | ||
|
||
from tap_mysql.sync_strategies.common import row_to_singer_record | ||
|
||
|
||
def test_row_to_singer_record(): | ||
catalog_entry = CatalogEntry( | ||
stream='stream', | ||
schema=Schema.from_dict({ | ||
'type': 'object', | ||
'properties': { | ||
'time': { | ||
'type': 'string', | ||
'format': 'time', | ||
}, | ||
}, | ||
}), | ||
) | ||
message = row_to_singer_record( | ||
catalog_entry, | ||
version=1, | ||
row=(timedelta(hours=8, minutes=30),), | ||
columns=['time'], | ||
time_extracted=datetime.now(timezone.utc), | ||
) | ||
|
||
assert message.stream == 'stream' | ||
assert message.version == 1 | ||
assert message.record == {'time': '08:30:00'} | ||
assert message.time_extracted is not None |