Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new slice test #2939

Merged
merged 5 commits into from
Jun 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def add(self):
return self.render_template(
"superset/add_slice.html",
bootstrap_data=json.dumps({
'datasources': sorted(datasources),
'datasources': sorted(datasources, key=lambda d: d["label"]),
}),
)

Expand Down
11 changes: 9 additions & 2 deletions tests/core_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,24 @@ def test_slices(self):
logging.info("[{name}]/[{method}]: {url}".format(**locals()))
self.client.get(url)

def test_add_slice(self):
def test_tablemodelview_list(self):
self.login(username='admin')

# Click on the + to add a slice
url = '/tablemodelview/list/'
resp = self.get_resp(url)

# assert that a table is listed
table = db.session.query(SqlaTable).first()
assert table.name in resp
assert '/superset/explore/table/{}'.format(table.id) in resp

def test_add_slice(self):
self.login(username='admin')
# assert that /slicemodelview/add responds with 200
url = '/slicemodelview/add'
resp = self.client.get(url)
self.assertEqual(resp.status_code, 200)

def test_slices_V2(self):
# Add explore-v2-beta role to admin user
# Test all slice urls as user with with explore-v2-beta role
Expand Down