Example #1
0
 def test_robots_allowed(self):
     """Test robots.txt generation when crawling allowed."""
     # Include a user who's not Rep
     UserFactory.create(userprofile__display_name='foo', groups=['Mozillian'])
     rep = UserFactory.create(groups=['Rep'])
     factory = RequestFactory()
     request = factory.get('/robots.txt')
     response = robots_txt(request)
     eq_(response.content,
         ('User-agent: *\nDisallow: /reports/\n'
          'Disallow: /u/{0}/r/\n'.format(rep.userprofile.display_name)))
Example #2
0
 def test_robots_allowed(self):
     """Test robots.txt generation when crawling allowed."""
     # Include a user who's not Rep
     UserFactory.create(userprofile__display_name='foo',
                        groups=['Mozillian'])
     factory = RequestFactory()
     request = factory.get('/robots.txt')
     response = robots_txt(request)
     eq_(response.content,
         ('User-agent: *\nDisallow: /reports/\nDisallow: /u/md/r/\n'
          'Disallow: /u/koki/r/\nDisallow: /u/koufos/r/\n'
          'Disallow: /u/js/r/\n'))
Example #3
0
 def test_robots_disallowed(self):
     """Test robots.txt generation when crawling disallowed."""
     factory = RequestFactory()
     request = factory.get('/robots.txt')
     response = robots_txt(request)
     eq_(response.content, 'User-agent: *\nDisallow: /')
Example #4
0
 def test_robots_disallowed(self):
     """Test robots.txt generation when crawling disallowed."""
     factory = RequestFactory()
     request = factory.get('/robots.txt')
     response = robots_txt(request)
     eq_(response.content, 'User-agent: *\nDisallow: /')
Example #5
0
 def test_robots_allowed(self):
     """Test robots.txt generation when crawling allowed."""
     factory = RequestFactory()
     request = factory.get("/robots.txt")
     response = robots_txt(request)
     eq_(response.content, "User-agent: *\nAllow: /")