mirror of https://github.com/apache/superset.git
Test that coverage actually works
This commit is contained in:
parent
0a8a1eda94
commit
986b59169a
|
@ -5,12 +5,14 @@ python:
|
|||
cache:
|
||||
directories:
|
||||
- $HOME/.wheelhouse/
|
||||
before_install:
|
||||
- rm -rf ~/.npm
|
||||
- mkdir ~/.npm
|
||||
install:
|
||||
- pip wheel -w $HOME/.wheelhouse -f $HOME/.wheelhouse -r requirements.txt
|
||||
- pip install --find-links=$HOME/.wheelhouse --no-index -rrequirements.txt
|
||||
- python setup.py install
|
||||
- cd dashed/assets
|
||||
- "touch $HOME/.npm/foo.lock; rm -f $HOME/.npm/*.lock"
|
||||
- npm install
|
||||
- npm run prod
|
||||
- cd $TRAVIS_BUILD_DIR
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"dev": "webpack -d --watch --colors",
|
||||
"prod": "webpack -p --colors",
|
||||
"prod": "webpack -p --colors --progress",
|
||||
"lint": "npm run --silent lint:js",
|
||||
"lint:js": "eslint --ignore-path=.eslintignore --ext .js ."
|
||||
},
|
||||
|
|
|
@ -122,9 +122,12 @@ class Slice(Model, AuditMixinNullable):
|
|||
cache_timeout = Column(Integer)
|
||||
|
||||
table = relationship(
|
||||
'SqlaTable', foreign_keys=[table_id], backref='slices')
|
||||
'SqlaTable', foreign_keys=[table_id], backref='slices',
|
||||
lazy='subquery')
|
||||
druid_datasource = relationship(
|
||||
'DruidDatasource', foreign_keys=[druid_datasource_id], backref='slices')
|
||||
'DruidDatasource', foreign_keys=[druid_datasource_id],
|
||||
backref='slices',
|
||||
lazy='subquery')
|
||||
|
||||
def __repr__(self):
|
||||
return self.slice_name
|
||||
|
@ -151,9 +154,7 @@ class Slice(Model, AuditMixinNullable):
|
|||
@utils.memoized
|
||||
def viz(self):
|
||||
d = json.loads(self.params)
|
||||
viz = viz_types[self.viz_type](
|
||||
self.datasource,
|
||||
form_data=d)
|
||||
viz = viz_types[self.viz_type](self.datasource, form_data=d)
|
||||
return viz
|
||||
|
||||
@property
|
||||
|
|
|
@ -6,12 +6,12 @@ os.environ['DASHED_CONFIG'] = 'tests.dashed_test_config'
|
|||
from flask.ext.testing import LiveServerTestCase, TestCase
|
||||
|
||||
import dashed
|
||||
from dashed import app, db, models, utils
|
||||
from dashed import app, db, models, utils, get_session
|
||||
BASE_DIR = app.config.get("BASE_DIR")
|
||||
cli = imp.load_source('cli', BASE_DIR + "/bin/dashed")
|
||||
|
||||
|
||||
class LiveTest(TestCase):
|
||||
class LiveTest(unittest.TestCase):
|
||||
|
||||
def create_app(self):
|
||||
app.config['LIVESERVER_PORT'] = 8873
|
||||
|
@ -19,7 +19,7 @@ class LiveTest(TestCase):
|
|||
return app
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
self.client = self.create_app().test_client()
|
||||
|
||||
def test_init(self):
|
||||
utils.init(dashed)
|
||||
|
@ -30,17 +30,23 @@ class LiveTest(TestCase):
|
|||
def test_slices(self):
|
||||
# Testing by running all the examples
|
||||
Slc = models.Slice
|
||||
for slc in db.session.query(Slc).all():
|
||||
print(slc)
|
||||
self.client.get(slc.slice_url)
|
||||
viz = slc.viz
|
||||
self.client.get(viz.get_url())
|
||||
if hasattr(viz, 'get_json'):
|
||||
self.client.get(viz.get_json())
|
||||
session = get_session()
|
||||
urls = []
|
||||
for slc in session.query(Slc).all():
|
||||
urls.append(slc.slice_url)
|
||||
urls.append(slc.viz.json_endpoint)
|
||||
for url in urls:
|
||||
self.client.get(url)
|
||||
session.commit()
|
||||
session.close()
|
||||
|
||||
def test_csv(self):
|
||||
self.client.get('/dashed/explore/table/1/?viz_type=table&granularity=ds&since=100+years&until=now&metrics=count&groupby=name&limit=50&show_brush=y&show_brush=false&show_legend=y&show_brush=false&rich_tooltip=y&show_brush=false&show_brush=false&show_brush=false&show_brush=false&y_axis_format=&x_axis_showminmax=y&show_brush=false&line_interpolation=linear&rolling_type=None&rolling_periods=&time_compare=&num_period_compare=&where=&having=&flt_col_0=gender&flt_op_0=in&flt_eq_0=&flt_col_0=gender&flt_op_0=in&flt_eq_0=&slice_id=14&slice_name=Boys&collapsed_fieldsets=&action=&datasource_name=birth_names&datasource_id=1&datasource_type=table&previous_viz_type=line&csv=true')
|
||||
|
||||
def misc(self):
|
||||
self.client.get('/health')
|
||||
self.client.get('/ping')
|
||||
|
||||
def test_dashboard(self):
|
||||
for dash in db.session.query(models.Dashboard).all():
|
||||
self.client.get(dash.url)
|
||||
|
|
Loading…
Reference in New Issue