Skip to content

Commit

Permalink
adding tests for #1131 (#1902)
Browse files Browse the repository at this point in the history
* Add login test

* Add add-slice test

* Fix linting errors

* Use get_resp()helper method instead of self.client.get()

* Fix failing test.

* Add checks for URLs in the tablemodelview

* Fix linting errors

* Address pull request comments

* Address pull request comments

* Remove accidentally added files

* Fix failing test
  • Loading branch information
Saleh Hindi authored and mistercrunch committed Feb 10, 2017
1 parent cea310e commit daa1420
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/core_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@ def setUp(self):
def tearDown(self):
db.session.query(models.Query).delete()

def test_login(self):
resp = self.get_resp(
'/login/',
data=dict(username='admin', password='general'))
self.assertIn('Welcome', resp)

resp = self.get_resp('/logout/', follow_redirects=True)
self.assertIn('User confirmation needed', resp)

resp = self.get_resp(
'/login/',
data=dict(username='admin', password='wrongPassword'))
self.assertNotIn('Welcome', resp)
self.assertIn('User confirmation needed', resp)

def test_welcome(self):
self.login()
resp = self.client.get('/superset/welcome')
Expand Down Expand Up @@ -161,6 +176,17 @@ def test_slices(self):
logging.info("[{name}]/[{method}]: {url}".format(**locals()))
self.client.get(url)

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

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

table = db.session.query(models.SqlaTable).first()
assert table.name in resp
assert '/superset/explore/table/{}'.format(table.id) in resp

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

0 comments on commit daa1420

Please sign in to comment.