You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ensure that links are not broken and that internal links use https and not http. Using the example provided by hypothesis
fromhypothesis.statefulimportGenericStateMachineimporthypothesis.strategiesasstfromrequests_htmlimportHTMLSessionclassLinkChecker(GenericStateMachine):
def__init__(self):
super(LinkChecker, self).__init__()
self.session=HTMLSession()
self.result=Nonedefsteps(self):
ifself.resultisNone:
# Always start on the home pagereturnst.just("https://hypothesis.works/")
else:
returnst.sampled_from([
lforlinself.result.html.absolute_links# Don't try to crawl to other people's sitesifl.startswith("https://hypothesis.works") and# Avoid Cloudflare's bot protection. We are a bot but we don't# care about the info it's hiding.'/cdn-cgi/'notinl
])
defexecute_step(self, step):
self.result=self.session.get(step)
assertself.result.status_code==200forlinself.result.html.absolute_links:
# All links should be HTTPSassert"http://hypothesis.works"notinlTestLinks=LinkChecker.TestCase
The text was updated successfully, but these errors were encountered:
Ensure that links are not broken and that internal links use https and not http. Using the example provided by hypothesis
The text was updated successfully, but these errors were encountered: