Skip to content

Commit

Permalink
Merge pull request #3 from maramsumanth/malformed
Browse files Browse the repository at this point in the history
Test for malformed disallow directives
  • Loading branch information
whalebot-helmsman authored Oct 21, 2019
2 parents 8cc4b85 + bf5d4c3 commit af3a909
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_protego.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ def test_allowed(self):
self.assertTrue(rp.can_fetch("https://www.site.local/abc/d", "*"))
self.assertFalse(rp.can_fetch("https://www.site.local/disallowed", "*"))

def test_malformed_disallow(self):
content = ("User-agent: * \n"
"Disallow: /one \n"
"Dissallow: /two \n"
"Dissalow: /three \n"
"Disalow: /four \n"
"Diasllow: /five \n"
"Disallaw: /six \n")
rp = Protego.parse(content=content)
self.assertFalse(rp.can_fetch("https://www.site.local/one", "*"))
self.assertFalse(rp.can_fetch("https://www.site.local/two", "*"))
self.assertFalse(rp.can_fetch("https://www.site.local/three", "*"))
self.assertFalse(rp.can_fetch("https://www.site.local/four", "*"))
self.assertFalse(rp.can_fetch("https://www.site.local/five", "*"))
self.assertFalse(rp.can_fetch("https://www.site.local/six", "*"))

def test_length_based_precedence(self):
content = ("User-agent: * \n"
"Disallow: / \n"
Expand Down

0 comments on commit af3a909

Please sign in to comment.