def test_add_flashes_error_if_uri_already_blocked(self, pyramid_request): pyramid_request.params = {'add': 'blocked1'} pyramid_request.session.flash = mock.Mock() badge_add(pyramid_request) assert pyramid_request.session.flash.call_count == 1
def test_add_flashes_error_if_uri_already_blocked(self, pyramid_request): pyramid_request.params = {'add': 'blocked1'} pyramid_request.session.flash = mock.Mock() badge_add(pyramid_request) assert pyramid_request.session.flash.call_count == 1
def test_add_redirects_to_index_if_uri_already_blocked(self, pyramid_request): pyramid_request.params = {'add': 'blocked1'} result = badge_add(pyramid_request) assert isinstance(result, httpexceptions.HTTPSeeOther) assert result.location == '/adm/badge'
def test_add_redirects_to_index(self, pyramid_request): pyramid_request.params = {'add': 'test_uri'} result = badge_add(pyramid_request) assert isinstance(result, httpexceptions.HTTPSeeOther) assert result.location == '/adm/badge'
def test_add_blocks_uri(self, pyramid_request): pyramid_request.params = {'add': 'test_uri'} badge_add(pyramid_request) assert models.Blocklist.is_blocked(pyramid_request.db, 'test_uri')
def test_add_blocks_uri(self, pyramid_request): pyramid_request.params = {'add': 'test_uri'} badge_add(pyramid_request) assert models.Blocklist.is_blocked(pyramid_request.db, 'test_uri')