Skip to content

Commit

Permalink
[ckan#2544] Fix private dataset tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brew committed Mar 23, 2016
1 parent ea1f04b commit aeb92f6
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions ckan/tests/controllers/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,11 +590,9 @@ def test_anonymous_users_cannot_read_private_datasets(self):
app = helpers._get_test_app()
response = app.get(
url_for(controller='package', action='read', id=dataset['name']),
status=404
)
# get redirected if you are not logged in
response = response.follow()
assert_in('Unauthorized to read package {0}'.format(dataset['name']),
response.body)
assert_equal(404, response.status_int)

def test_user_not_in_organization_cannot_read_private_datasets(self):
user = factories.User()
Expand All @@ -607,10 +605,9 @@ def test_user_not_in_organization_cannot_read_private_datasets(self):
response = app.get(
url_for(controller='package', action='read', id=dataset['name']),
extra_environ={'REMOTE_USER': user['name'].encode('ascii')},
expect_errors=True
status=404
)
assert_equal(401, response.status_int)
assert_in('Unauthorized to read package', response.body)
assert_equal(404, response.status_int)

def test_read_rdf(self):
''' The RDF outputs now live in ckanext-dcat'''
Expand Down Expand Up @@ -1168,13 +1165,9 @@ def test_anonymous_users_cannot_read_private_datasets(self):
app = helpers._get_test_app()
response = app.get(
url_for(controller='package', action='read', id=dataset['name']),
status=404
)
# get redirected if you are not logged in
response = response.follow()
assert_in(
'Unauthorized to read package {0}'.format(dataset['name']),
response.body
)
assert_equal(404, response.status_int)


class TestResourceDelete(helpers.FunctionalTestBase):
Expand Down

0 comments on commit aeb92f6

Please sign in to comment.