Merge branch 'main' into dk/685-show-requested-domain

This commit is contained in:
David Kennedy 2023-08-30 15:24:33 -04:00
commit 127a30a20d
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
4 changed files with 29 additions and 2 deletions

View file

@ -238,7 +238,7 @@ class Client(oic.Client):
"client_secret": self.client_secret,
},
authn_method=self.registration_response["token_endpoint_auth_method"],
# There is a time desync issue between login.gov and cloud,
# There is a time desync issue between login.gov and cloud
# this addresses that by adding a clock skew.
skew=10,
)

View file

@ -17,7 +17,7 @@ Load our custom filters to extract info from the django generated markup.
<thead>
<tr>
{% if results.0.form %}
{% if results.0|contains_checkbox %}
{# .gov - hardcode the select all checkbox #}
<th scope="col" class="action-checkbox-column" title="Toggle all">
<div class="text">

View file

@ -40,3 +40,11 @@ def slice_after(value, substring):
result = value[index + len(substring) :]
return result
return value
@register.filter
def contains_checkbox(html_list):
for html_string in html_list:
if re.search(r'<input[^>]*type="checkbox"', html_string):
return True
return False

View file

@ -8,6 +8,7 @@ from registrar.templatetags.custom_filters import (
extract_a_text,
find_index,
slice_after,
contains_checkbox,
)
@ -83,3 +84,21 @@ class CustomFiltersTestCase(TestCase):
self.assertEqual(
result, value
) # Should return the original value if substring not found
def test_contains_checkbox_with_checkbox(self):
# Test the filter when HTML list contains a checkbox
html_list = [
'<input type="checkbox" name="_selected_action">',
"<div>Some other HTML content</div>",
]
result = contains_checkbox(html_list)
self.assertTrue(result) # Expecting True
def test_contains_checkbox_without_checkbox(self):
# Test the filter when HTML list does not contain a checkbox
html_list = [
"<div>Some HTML content without checkbox</div>",
"<p>More HTML content</p>",
]
result = contains_checkbox(html_list)
self.assertFalse(result) # Expecting False