Skip to content

Commit

Permalink
Fix setting of user of profile in factory
Browse files Browse the repository at this point in the history
When trying to create a profile without a preset user django complains
We always set a user in tests, which is why this was undiscovered
  • Loading branch information
johannaengland committed Sep 20, 2023
1 parent 535c733 commit 12898b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/argus/notificationprofile/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class NotificationProfileFactory(factory.django.DjangoModelFactory):
class Meta:
model = models.NotificationProfile

user = factory.SubFactory(PersonUserFactory, user=factory.SelfAttribute("..timeslot"))
user = factory.LazyAttribute(lambda profile: profile.timeslot.user)
timeslot = factory.SubFactory(TimeslotFactory)
active = factory.Faker("boolean")

Expand Down

0 comments on commit 12898b1

Please sign in to comment.