Adding postgres to the build matrix (#604)

This commit is contained in:
Maxime Beauchemin
2016-06-12 11:01:16 -07:00
committed by GitHub
parent c490138afe
commit fa13b77cfa
7 changed files with 25 additions and 19 deletions

View File

@@ -8,7 +8,6 @@ from datetime import datetime
import doctest
import json
import imp
import logging
import os
import unittest
from mock import Mock, patch
@@ -70,14 +69,12 @@ class CaravelTestCase(unittest.TestCase):
assert 'Welcome' in resp.data.decode('utf-8')
def logout(self):
resp = self.client.get('/logout/', follow_redirects=True)
self.client.get('/logout/', follow_redirects=True)
'''
def test_welcome(self):
self.login()
resp = self.client.get('/caravel/welcome')
assert 'Welcome' in resp.data.decode('utf-8')
'''
def setup_public_access_for_dashboard(self, table_name):
public_role = appbuilder.sm.find_role('Public')
@@ -101,9 +98,13 @@ class CoreTests(CaravelTestCase):
def __init__(self, *args, **kwargs):
# Load examples first, so that we setup proper permission-view relations
# for all example data sources.
self.load_examples()
super(CoreTests, self).__init__(*args, **kwargs)
self.table_ids = {tbl.table_name: tbl.id for tbl in (
@classmethod
def setUpClass(cls):
cli.load_examples(load_test_data=True)
utils.init(caravel)
cls.table_ids = {tbl.table_name: tbl.id for tbl in (
db.session
.query(models.SqlaTable)
.all()
@@ -115,16 +116,14 @@ class CoreTests(CaravelTestCase):
def tearDown(self):
pass
def load_examples(self):
cli.load_examples(load_test_data=True)
def test_save_slice(self):
self.login(username='admin')
slice_id = (
slc = (
db.session.query(models.Slice.id)
.filter_by(slice_name="Energy Sankey")
.scalar())
.first())
slice_id = slc.id
copy_name = "Test Sankey Save"
tbl_id = self.table_ids.get('energy_usage')
@@ -152,7 +151,7 @@ class CoreTests(CaravelTestCase):
(slc.slice_name, 'csv_endpoint', slc.viz.csv_endpoint),
]
for name, method, url in urls:
logging.info("[{name}]/[{method}]: {url}".format(**locals()))
print("[{name}]/[{method}]: {url}".format(**locals()))
self.client.get(url)
def test_dashboard(self):
@@ -228,7 +227,7 @@ class CoreTests(CaravelTestCase):
# Try access after adding appropriate permissions.
resp = self.client.get('/slicemodelview/list/')
data = resp.data.decode('utf-8')
assert 'birth_names</a>' in data
assert 'birth_names' in data
resp = self.client.get('/dashboardmodelview/list/')
data = resp.data.decode('utf-8')