Skip to content

Commit e7fb0af

Browse files
authored
Merge pull request #442 from johannaengland/tests/incident-event-endpoints
Add more tests for incident endpoints in API v1 & v2
2 parents 041bb08 + 9477ce4 commit e7fb0af

File tree

3 files changed

+641
-128
lines changed

3 files changed

+641
-128
lines changed

src/argus/incident/factories.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,23 @@ class Meta:
7575
incident = factory.SubFactory(IncidentFactory)
7676
added_by = factory.SubFactory(SourceUserFactory)
7777
added_time = factory.Faker("date_time_between", start_date="-1d", end_date="+1d", tzinfo=pytz.UTC)
78+
79+
80+
class EventFactory(factory.django.DjangoModelFactory):
81+
class Meta:
82+
model = models.Event
83+
84+
incident = factory.SubFactory(IncidentFactory)
85+
actor = factory.SubFactory(SourceUserFactory)
86+
timestamp = factory.Faker("date_time_between", start_date="-1d", end_date="+1d", tzinfo=pytz.UTC)
87+
received = timestamp
88+
type = models.Event.Type.OTHER
89+
description = factory.Faker("sentence")
90+
91+
92+
class AcknowledgementFactory(factory.django.DjangoModelFactory):
93+
class Meta:
94+
model = models.Acknowledgement
95+
96+
event = factory.SubFactory(EventFactory, type=models.Event.Type.ACKNOWLEDGE)
97+
expiration = factory.Faker("date_time_between", start_date="+1d", end_date="+2d", tzinfo=pytz.UTC)

tests/incident/test_tags.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)