Skip to content

Commit

Permalink
Review fixes: test that public user has access only to permitted data…
Browse files Browse the repository at this point in the history
… sets
  • Loading branch information
Andrii Sydorchuk committed May 2, 2016
1 parent 2c602e7 commit 31c072d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion caravel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from flask.ext.appbuilder import Model
from flask.ext.appbuilder.models.mixins import AuditMixin
from flask.ext.appbuilder.models.decorators import renders
from flask.ext.babelpkg import lazy_gettext as _
from flask.ext.babelpkg import gettext as _

from pydruid.client import PyDruid
from pydruid.utils.filters import Dimension, Filter
Expand Down
2 changes: 1 addition & 1 deletion caravel/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from flask.ext.appbuilder.actions import action
from flask.ext.appbuilder.models.sqla.interface import SQLAInterface
from flask.ext.appbuilder.security.decorators import has_access
from flask.ext.babelpkg import lazy_gettext as _
from flask.ext.babelpkg import gettext as _
from flask_appbuilder.models.sqla.filters import BaseFilter

from pydruid.client import doublesum
Expand Down
17 changes: 17 additions & 0 deletions tests/core_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,23 @@ def test_public_user_dashboard_access(self):
data = resp.data.decode('utf-8')
assert '[dashboard] Births' in data

resp = self.client.get('/caravel/explore/table/3/')
data = resp.data.decode('utf-8')
assert '[explore] birth_names' in data

# Confirm that public doesn't have access to other datasets.
resp = self.client.get('/slicemodelview/list/')
data = resp.data.decode('utf-8')
assert '<a href="/tablemodelview/edit/2">wb_health_population</a>' not in data

resp = self.client.get('/dashboardmodelview/list/')
data = resp.data.decode('utf-8')
assert '<a href="/caravel/dashboard/world_health/">' not in data

resp = self.client.get('/caravel/explore/table/2/', follow_redirects=True)
data = resp.data.decode('utf-8')
assert "You don&#39;t seem to have access to this datasource" in data


SEGMENT_METADATA = [{
"id": "some_id",
Expand Down

0 comments on commit 31c072d

Please sign in to comment.