This commit is contained in:
rachidatecs 2023-07-06 15:30:36 -04:00
parent 10b0700657
commit 4eafe9a2f8
No known key found for this signature in database
GPG key ID: 3CEBBFA7325E5525
2 changed files with 21 additions and 11 deletions

View file

@ -158,16 +158,15 @@ def completed_application(
return application
def mock_user():
"""A simple user."""
user_kwargs = dict(
id = 4,
first_name = "Rachid",
last_name = "Mrad",
id=4,
first_name="Rachid",
last_name="Mrad",
)
user, _ = User.objects.get_or_create(
**user_kwargs
)
user, _ = User.objects.get_or_create(**user_kwargs)
return user

View file

@ -192,7 +192,11 @@ class TestDomainApplicationAdmin(TestCase):
# Follow=True handles the redirect
response = self.client.get(
"/admin/registrar/domainapplication/",
{"status__exact": "started", "investigator__id__exact": user.id, "q": "Hello"},
{
"status__exact": "started",
"investigator__id__exact": user.id,
"q": "Hello",
},
follow=True,
)
@ -207,7 +211,10 @@ class TestDomainApplicationAdmin(TestCase):
filters,
[
{"parameter_name": "status", "parameter_value": "started"},
{"parameter_name": "investigator", "parameter_value": user.first_name + " " + user.last_name},
{
"parameter_name": "investigator",
"parameter_value": user.first_name + " " + user.last_name,
},
],
)
@ -215,7 +222,11 @@ class TestDomainApplicationAdmin(TestCase):
# Create a mock request object
request = self.factory.get("/admin/yourmodel/")
# Set the GET parameters for testing
request.GET = {"status": "started", "investigator": "Rachid Mrad", "q": "search_value"}
request.GET = {
"status": "started",
"investigator": "Rachid Mrad",
"q": "search_value",
}
# Call the get_filters method
filters = self.admin.get_filters(request)