mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-16 06:24:12 +02:00
updated linter length; linter reformatted several files
This commit is contained in:
parent
f0636013e0
commit
c760417e6a
65 changed files with 550 additions and 1727 deletions
|
@ -52,9 +52,7 @@ def iter_patterns(urlconf, patterns=None, namespace=None):
|
|||
if isinstance(pattern, URLPattern):
|
||||
viewname = pattern.name
|
||||
if viewname is None and namespace not in NAMESPACES_WITH_UNNAMED_VIEWS:
|
||||
raise AssertionError(
|
||||
f"namespace {namespace} cannot contain unnamed views"
|
||||
)
|
||||
raise AssertionError(f"namespace {namespace} cannot contain unnamed views")
|
||||
if namespace and viewname is not None:
|
||||
viewname = f"{namespace}:{viewname}"
|
||||
yield (viewname, pattern.pattern)
|
||||
|
@ -65,9 +63,7 @@ def iter_patterns(urlconf, patterns=None, namespace=None):
|
|||
raise AssertionError("nested namespaces are not currently supported")
|
||||
if pattern.namespace in IGNORE_NAMESPACES:
|
||||
continue
|
||||
yield from iter_patterns(
|
||||
urlconf, pattern.url_patterns, namespace or pattern.namespace
|
||||
)
|
||||
yield from iter_patterns(urlconf, pattern.url_patterns, namespace or pattern.namespace)
|
||||
else:
|
||||
raise AssertionError("unknown pattern class")
|
||||
|
||||
|
@ -91,9 +87,7 @@ def iter_sample_urls(urlconf):
|
|||
|
||||
for kwarg in named_groups:
|
||||
if kwarg not in SAMPLE_KWARGS:
|
||||
raise AssertionError(
|
||||
f'Sample value for {kwarg} in pattern "{route}" not found'
|
||||
)
|
||||
raise AssertionError(f'Sample value for {kwarg} in pattern "{route}" not found')
|
||||
kwargs[kwarg] = SAMPLE_KWARGS[kwarg]
|
||||
|
||||
url = reverse(viewname, args=args, kwargs=kwargs)
|
||||
|
@ -141,15 +135,13 @@ class TestURLAuth(TestCase):
|
|||
self.assertRegex(
|
||||
redirect,
|
||||
r"^\/openid\/login",
|
||||
f"GET {url} should redirect to login or deny access, but instead "
|
||||
f"it redirects to {redirect}",
|
||||
f"GET {url} should redirect to login or deny access, but instead " f"it redirects to {redirect}",
|
||||
)
|
||||
elif code == 401 or code == 403:
|
||||
pass
|
||||
else:
|
||||
raise AssertionError(
|
||||
f"GET {url} returned HTTP {code}, but should redirect to login or "
|
||||
"deny access",
|
||||
f"GET {url} returned HTTP {code}, but should redirect to login or deny access",
|
||||
)
|
||||
|
||||
def test_login_required_all_urls(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue