mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 12:08:40 +02:00
fixed unit test and linting
This commit is contained in:
parent
7e3a2266a2
commit
5475f07d9b
2 changed files with 5 additions and 3 deletions
|
@ -1,13 +1,14 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.contrib.auth.models import User
|
from registrar.models import User
|
||||||
from waffle.testutils import override_flag
|
from waffle.testutils import override_flag
|
||||||
from registrar.utility.waffle import flag_is_active_for_user
|
from registrar.utility.waffle import flag_is_active_for_user
|
||||||
|
|
||||||
|
|
||||||
class FlagIsActiveForUserTest(TestCase):
|
class FlagIsActiveForUserTest(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
# Set up a test user
|
# Set up a test user
|
||||||
self.user = User.objects.create_user(username="testuser", password="testpassword")
|
self.user = User.objects.create_user(username="testuser")
|
||||||
|
|
||||||
@override_flag("test_flag", active=True)
|
@override_flag("test_flag", active=True)
|
||||||
def test_flag_active_for_user(self):
|
def test_flag_active_for_user(self):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
from waffle.decorators import flag_is_active
|
from waffle.decorators import flag_is_active
|
||||||
|
|
||||||
|
|
||||||
def flag_is_active_for_user(user, flag_name):
|
def flag_is_active_for_user(user, flag_name):
|
||||||
"""flag_is_active_for_user can be used when a waffle_flag may be
|
"""flag_is_active_for_user can be used when a waffle_flag may be
|
||||||
activated for a user, but the context of where the flag needs to
|
activated for a user, but the context of where the flag needs to
|
||||||
|
@ -8,4 +9,4 @@ def flag_is_active_for_user(user, flag_name):
|
||||||
When the request is available, flag_is_active should be used."""
|
When the request is available, flag_is_active should be used."""
|
||||||
request = HttpRequest()
|
request = HttpRequest()
|
||||||
request.user = user
|
request.user = user
|
||||||
return flag_is_active(request, flag_name)
|
return flag_is_active(request, flag_name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue