adding tests for #1131 (#1902)

* 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
This commit is contained in:
Saleh Hindi 2017-02-10 04:17:49 -05:00 committed by Maxime Beauchemin
parent cea310e50b
commit daa1420c8e
1 changed files with 26 additions and 0 deletions

View File

@ -42,6 +42,21 @@ class CoreTests(SupersetTestCase):
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')
@ -161,6 +176,17 @@ class CoreTests(SupersetTestCase):
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