fixed unit test and linting

This commit is contained in:
David Kennedy 2024-09-20 16:35:23 -04:00
parent 7e3a2266a2
commit 5475f07d9b
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
2 changed files with 5 additions and 3 deletions

View file

@ -1,13 +1,14 @@
from django.test import TestCase
from django.contrib.auth.models import User
from registrar.models import User
from waffle.testutils import override_flag
from registrar.utility.waffle import flag_is_active_for_user
class FlagIsActiveForUserTest(TestCase):
def setUp(self):
# 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)
def test_flag_active_for_user(self):

View file

@ -1,6 +1,7 @@
from django.http import HttpRequest
from waffle.decorators import flag_is_active
def flag_is_active_for_user(user, flag_name):
"""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
@ -8,4 +9,4 @@ def flag_is_active_for_user(user, flag_name):
When the request is available, flag_is_active should be used."""
request = HttpRequest()
request.user = user
return flag_is_active(request, flag_name)
return flag_is_active(request, flag_name)