Skip to content

Commit 1922ff6

Browse files
committed
Adding test to reproduce prod exception
1 parent c9c9e1f commit 1922ff6

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/unit/test_stream_app.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,3 +615,40 @@ def stream_app(event, api, cache):
615615
result_event: StreamDepthEvent = stream_app(event, context)[0]
616616

617617
assert result_event.log_identifier == 'log_identifier'
618+
619+
620+
def test_raw_stream_event_with_none_data_field_returns_expected_result(context):
621+
"""Make sure that raw stream event with empty data field
622+
can be handled without validation exception.
623+
"""
624+
625+
@stream
626+
def stream_app(event, api, cache):
627+
return event
628+
629+
event = [
630+
{
631+
"metadata": {
632+
"app_stream_id": 123,
633+
"apps": {"test-provider.test-app-name": {"app_connection_id": 456}},
634+
"log_type": "time",
635+
"source_type": "drilling",
636+
},
637+
"records": [
638+
{
639+
"app": "corva.wits-historical-import",
640+
"asset_id": 1,
641+
"collection": "wits.completed",
642+
"company_id": 80,
643+
"data": None,
644+
"provider": "corva",
645+
"timestamp": 1688999883,
646+
"version": 1,
647+
}
648+
],
649+
}
650+
]
651+
652+
result_event: StreamTimeEvent = stream_app(event, context)[0]
653+
654+
assert result_event is None

0 commit comments

Comments
 (0)