mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-15 22:14:15 +02:00
Linting
This commit is contained in:
parent
b50f14fd3b
commit
39d51004fd
2 changed files with 6 additions and 4 deletions
|
@ -786,6 +786,7 @@ def create_staffuser():
|
||||||
user.groups.set([group])
|
user.groups.set([group])
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
||||||
def create_user():
|
def create_user():
|
||||||
"""Creates a user with no special permissions"""
|
"""Creates a user with no special permissions"""
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
@ -799,6 +800,7 @@ def create_user():
|
||||||
)
|
)
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
||||||
def create_ready_domain():
|
def create_ready_domain():
|
||||||
domain, _ = Domain.objects.get_or_create(name="city.gov", state=Domain.State.READY)
|
domain, _ = Domain.objects.get_or_create(name="city.gov", state=Domain.State.READY)
|
||||||
return domain
|
return domain
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
from unittest import skip
|
|
||||||
from waffle.decorators import flag_is_active
|
from waffle.decorators import flag_is_active
|
||||||
from django.test import TestCase, Client, RequestFactory
|
from django.test import TestCase, Client, RequestFactory
|
||||||
from registrar.models import (
|
from registrar.models import (
|
||||||
|
@ -9,6 +8,7 @@ from registrar.models import (
|
||||||
)
|
)
|
||||||
from registrar.tests.common import create_superuser, create_staffuser, create_user
|
from registrar.tests.common import create_superuser, create_staffuser, create_user
|
||||||
|
|
||||||
|
|
||||||
class TestFeatureFlags(TestCase):
|
class TestFeatureFlags(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
|
@ -32,7 +32,7 @@ class TestFeatureFlags(TestCase):
|
||||||
request = self.factory.get(location)
|
request = self.factory.get(location)
|
||||||
request.user = request_user
|
request.user = request_user
|
||||||
self.assertTrue(flag_is_active(request, flag_name))
|
self.assertTrue(flag_is_active(request, flag_name))
|
||||||
|
|
||||||
def assert_flag_not_active(self, request_user, flag_name, location="/"):
|
def assert_flag_not_active(self, request_user, flag_name, location="/"):
|
||||||
"""
|
"""
|
||||||
Checks if the given `request_user` has `flag_name` not active
|
Checks if the given `request_user` has `flag_name` not active
|
||||||
|
@ -59,7 +59,7 @@ class TestFeatureFlags(TestCase):
|
||||||
|
|
||||||
# Ensure that a normal user also can't access this flag
|
# Ensure that a normal user also can't access this flag
|
||||||
self.assert_flag_not_active(request_user=self.user, flag_name=flag.name)
|
self.assert_flag_not_active(request_user=self.user, flag_name=flag.name)
|
||||||
|
|
||||||
def test_flag_active_for_is_staff(self):
|
def test_flag_active_for_is_staff(self):
|
||||||
"""
|
"""
|
||||||
Tests flag_is_active for a flag with `is_staff = True`
|
Tests flag_is_active for a flag with `is_staff = True`
|
||||||
|
@ -158,4 +158,4 @@ class TestFeatureFlags(TestCase):
|
||||||
self.assert_flag_not_active(request_user=self.superuser, flag_name=flag.name)
|
self.assert_flag_not_active(request_user=self.superuser, flag_name=flag.name)
|
||||||
|
|
||||||
# Ensure that normal users cannot access this flag
|
# Ensure that normal users cannot access this flag
|
||||||
self.assert_flag_not_active(request_user=self.user, flag_name=flag.name)
|
self.assert_flag_not_active(request_user=self.user, flag_name=flag.name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue