Skip to content

Commit 1167704

Browse files
committed
simplify test
1 parent ebcb741 commit 1167704

File tree

1 file changed

+29
-65
lines changed

1 file changed

+29
-65
lines changed

tests/unit/test_stream_app.py

Lines changed: 29 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -631,71 +631,35 @@ def test_merge_events_stream_event(context):
631631
def stream_app(event, api, cache):
632632
return event
633633

634-
event = [
635-
RawStreamTimeEvent(
636-
records=[
637-
RawTimeRecord(
638-
collection=str(),
639-
timestamp=1,
640-
asset_id=1,
641-
company_id=1,
642-
),
643-
RawTimeRecord(
644-
collection=str(),
645-
timestamp=2,
646-
asset_id=1,
647-
company_id=1,
648-
),
649-
],
650-
metadata=RawMetadata(
651-
app_stream_id=1,
652-
apps={SETTINGS.APP_KEY: RawAppMetadata(app_connection_id=1)},
653-
log_type=LogType.time,
654-
),
655-
).dict(),
656-
RawStreamTimeEvent(
657-
records=[
658-
RawTimeRecord(
659-
collection=str(),
660-
timestamp=3,
661-
asset_id=1,
662-
company_id=1,
663-
),
664-
RawTimeRecord(
665-
collection=str(),
666-
timestamp=4,
667-
asset_id=1,
668-
company_id=1,
669-
),
670-
],
671-
metadata=RawMetadata(
672-
app_stream_id=1,
673-
apps={SETTINGS.APP_KEY: RawAppMetadata(app_connection_id=1)},
674-
log_type=LogType.time,
675-
),
676-
).dict(),
677-
RawStreamTimeEvent(
678-
records=[
679-
RawTimeRecord(
680-
collection=str(),
681-
timestamp=5,
682-
asset_id=1,
683-
company_id=1,
684-
),
685-
RawTimeRecord(
686-
collection=str(),
687-
timestamp=6,
688-
asset_id=1,
689-
company_id=1,
690-
),
691-
],
692-
metadata=RawMetadata(
693-
app_stream_id=1,
694-
apps={SETTINGS.APP_KEY: RawAppMetadata(app_connection_id=1)},
695-
log_type=LogType.time,
696-
),
697-
).dict(),
698-
]
634+
event = []
635+
timestamp = 1
636+
for _ in range(1, 4):
637+
event.extend(
638+
[
639+
RawStreamTimeEvent(
640+
records=[
641+
RawTimeRecord(
642+
collection=str(),
643+
timestamp=timestamp,
644+
asset_id=1,
645+
company_id=1,
646+
),
647+
RawTimeRecord(
648+
collection=str(),
649+
timestamp=timestamp + 1,
650+
asset_id=1,
651+
company_id=1,
652+
),
653+
],
654+
metadata=RawMetadata(
655+
app_stream_id=1,
656+
apps={SETTINGS.APP_KEY: RawAppMetadata(app_connection_id=1)},
657+
log_type=LogType.time,
658+
),
659+
).dict()
660+
]
661+
)
662+
timestamp += 2
699663

700664
result_event: StreamTimeEvent = stream_app(event, context)[0]
701665
assert len(result_event.records) == 6, "records were not merged into a single event"

0 commit comments

Comments
 (0)