Skip to content

Commit

Permalink
glamr/test: add comments to some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robert102 committed Dec 11, 2024
1 parent f67b68a commit 655e089
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions mibios/glamr/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,12 @@ def test_summaries(self):


class DeepLinkTests(TestDataMixin, TestCase):
"""
Test reachable, internal links starting from frontpage up to certain depth
"""
MAX_DEPTH = 2
""" if 1, then only check the given URL, if 2 then check all links on given
page. """

href_pat = re.compile(r'<a [^>]*href="([/?][^"]+)"')
""" pattern for local links """
Expand Down Expand Up @@ -450,6 +455,9 @@ def do_test_for_url(self, url, depth, parent):
self.do_test_for_url(next_url, depth + 1, parent=url)

def test_from_frontpage(self):
"""
test all pages reachable fron frontpage up to hard-coded depth
"""
self.urls_tested = set()
self.urls_too_deep = set()
self.do_test_for_url(reverse('frontpage'), depth=1, parent=None)
Expand All @@ -459,6 +467,12 @@ def test_from_frontpage(self):

@tag('longrun')
class VeryDeepLinkTests(DeepLinkTests):
"""
Test more URLs
At depth 2: ~1400 URLs in 6 minutes
At depth 3: ~8100 URLs more
"""
MAX_DEPTH = 3


Expand Down

0 comments on commit 655e089

Please sign in to comment.