Make usernames unique in tests (#3310)

Some tests (particularly when there are schedules and shifts involved)
depend on generated usernames being unique (we randomly get [CI
errors](https://github.com/grafana/oncall/actions/runs/6812435056/job/18524768961#step:5:676)
because of this). Although username field is not required to be unique,
I think it makes sense for testing purposes to enable this (and when a
duplicated username is needed in a test, make that explicit).
This commit is contained in:
Matias Bordese 2023-11-09 11:30:28 -03:00 committed by GitHub
parent dd348f01f9
commit e41ccb9d9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,7 @@ class OrganizationFactory(factory.DjangoModelFactory):
class UserFactory(factory.DjangoModelFactory):
username = factory.Faker("user_name")
username = UniqueFaker("user_name")
email = factory.Faker("email")
user_id = UniqueFaker("pyint")
avatar_url = factory.Faker("url")