@@ -159,11 +159,13 @@ def test_private_incident_visible_to_participant(self):
159159 assert incident .is_visible_to_user (participant ) is True
160160 assert incident .is_visible_to_user (other_user ) is False
161161
162- def test_private_incident_visible_to_admin (self ):
163- """Test private incident is visible to admin users"""
164- admin_user = User .
objects .
create_user (
username = "[email protected] " )
165- admin_user .userprofile .is_admin = True
166- admin_user .userprofile .save ()
162+ def test_private_incident_visible_to_superuser (self ):
163+ """Test private incident is visible to superusers"""
164+ superuser = User .objects .create_superuser (
165+ 166+ 167+ password = "test123" ,
168+ )
167169
168170 incident = Incident .objects .create (
169171 title = "Private Incident" ,
@@ -172,7 +174,7 @@ def test_private_incident_visible_to_admin(self):
172174 is_private = True ,
173175 )
174176
175- assert incident .is_visible_to_user (admin_user ) is True
177+ assert incident .is_visible_to_user (superuser ) is True
176178
177179 def test_affected_areas_property (self ):
178180 """Test affected_areas property returns list of tag names"""
@@ -362,11 +364,13 @@ def test_external_link_str(self):
362364
363365@pytest .mark .django_db
364366class TestFilterVisibleToUser :
365- def test_admin_sees_all_incidents (self ):
366- """Test admin users see all incidents"""
367- admin = User .
objects .
create_user (
username = "[email protected] " )
368- admin .userprofile .is_admin = True
369- admin .userprofile .save ()
367+ def test_superuser_sees_all_incidents (self ):
368+ """Test superusers see all incidents"""
369+ superuser = User .objects .create_superuser (
370+ 371+ 372+ password = "test123" ,
373+ )
370374
371375 public = Incident .objects .create (
372376 title = "Public" ,
@@ -383,7 +387,7 @@ def test_admin_sees_all_incidents(self):
383387 )
384388
385389 queryset = Incident .objects .all ()
386- filtered = filter_visible_to_user (queryset , admin )
390+ filtered = filter_visible_to_user (queryset , superuser )
387391
388392 assert filtered .count () == 2
389393 assert public in filtered
0 commit comments