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)))
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'))
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: /')
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: /")