Skip to content

Commit f7cf00b

Browse files
committed
Use get_or_create when creating test data, to avoid duplicate key warnings.
- Legacy-Id: 12259
1 parent 4f2eb07 commit f7cf00b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

ietf/utils/test_data.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def create_person(group, role_name, name=None, username=None, email_address=None
3434
Role.objects.create(group=group, name_id=role_name, person=person, email=email)
3535

3636
def create_group(**kwargs):
37-
return Group.objects.create(state_id="active", **kwargs)
37+
group, created = Group.objects.get_or_create(state_id="active", **kwargs)
38+
return group
3839

3940
def make_immutable_base_data():
4041
"""Some base data (groups, etc.) that doesn't need to be modified by

0 commit comments

Comments
 (0)