Skip to content

Commit

Permalink
Merge branch 'master' into big_number_total
Browse files Browse the repository at this point in the history
  • Loading branch information
michellethomas committed Mar 30, 2016
2 parents c239f81 + d885dd3 commit 2086607
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
repo_token: EMkVRVEKYgUESKaNN9QyOhPnFnKNqyDcJ
repo_token: eESbYiv4An6KEvjpmguDs4L7YkubXbqn1
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ babel
_build
_static
caravel/bin/caravelc
envpy3
env_py3
.eggs
build
*.db
tmp
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ before_install:
install:
- pip wheel -w $HOME/.wheelhouse -f $HOME/.wheelhouse .
- pip install --find-links=$HOME/.wheelhouse --no-index .
- pip install --find-links=$HOME/.wheelhouse --no-index -r dev-reqs.txt
- cd caravel/assets
- npm install
- npm run lint
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Video - Introduction to Caravel

Screenshots
------------
![img](http://i.imgur.com/bi09J9X.png)
![img](http://i.imgur.com/aOaH0ty.png)
![img](http://i.imgur.com/JRbTnTx.png)
![img](http://i.imgur.com/4wRtxwb.png)

Caravel
---------
Expand Down Expand Up @@ -127,10 +127,13 @@ power analytic dashboards and applications.*
More screenshots
----------------

![img](http://i.imgur.com/Rt6gNQ9.png)
![img](http://i.imgur.com/t7VOtqQ.png)
![img](http://i.imgur.com/PaiFQnH.png)
![img](http://i.imgur.com/CdcGHuC.png)
![img](http://i.imgur.com/MAFZTtU.png)
![img](http://i.imgur.com/xcy1QjN.png)
![img](http://i.imgur.com/RWqA8ly.png)
![img](http://i.imgur.com/D2kZL7q.png)
![img](http://i.imgur.com/0UPTK61.png)
![img](http://i.imgur.com/ahHoCuS.png)


Related Links
-------------
Expand Down
3 changes: 0 additions & 3 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ List of TODO items for Caravel
Caravel would discover and expose the plugins

## Features
* **Stars:** set dashboards, slices and datasets as favorites
* **Homepage:** a page that has links to your Slices and Dashes, favorited
content, feed of recent actions (people viewing your objects)
* **Dashboard URL filters:** `{dash_url}#fltin__fieldname__value1,value2`
* **Default slice:** choose a default slice for the dataset instead of
default endpoint
Expand Down
3 changes: 2 additions & 1 deletion caravel/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def iter_choices(self):
if value:
yield d.pop(value)
while d:
yield d.pop(d.keys()[0])
yield d.popitem(last=False)[1]


class FreeFormSelect(widgets.Select):
Expand Down Expand Up @@ -82,6 +82,7 @@ def get_field(self, fieldname):
return getattr(self, fieldname)

def field_css_classes(self, fieldname):
print(fieldname, self.css_classes[fieldname])
if fieldname in self.css_classes:
return " ".join(self.css_classes[fieldname])
return ""
Expand Down
2 changes: 1 addition & 1 deletion caravel/templates/caravel/explore.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
{% for fieldname in fieldset.fields %}
{% if not fieldname %}
<hr/>
{% elif not fieldname.__iter__ %}
{% elif fieldname is string %}
{{ panofield(fieldname) }}
{% else %}
<div class="row">
Expand Down
3 changes: 2 additions & 1 deletion caravel/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,9 @@ def explore(self, datasource_type, datasource_id):
else:
template = "caravel/explore.html"

resp = self.render_template(template, viz=obj, slice=slc)
try:
resp = self.render_template(template, viz=obj, slice=slc)
pass
except Exception as e:
if config.get("DEBUG"):
raise(e)
Expand Down
1 change: 1 addition & 0 deletions dev-reqs.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
coveralls
sphinx
sphinx_bootstrap_theme
1 change: 1 addition & 0 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
rm /tmp/caravel_unittests.db
rm -f .coverage
export CARAVEL_CONFIG=tests.caravel_test_config
caravel/bin/caravel db upgrade
python setup.py nosetests
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ all_files = 1
upload-dir = docs/_build/html

[nosetests]
verbosity=1
verbosity=3
detailed-errors=1
with-coverage=1
cover-package=caravel
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'flask-cache>=0.13.1, <0.14.0',
'flask-migrate>=1.5.1, <2.0.0',
'flask-script>=2.0.5, <3.0.0',
'flask-sqlalchemy==2.0.0',
'flask-testing>=0.4.2, <0.5.0',
'flask>=0.10.1, <1.0.0',
'humanize>=0.5.1, <0.6.0',
Expand Down
71 changes: 48 additions & 23 deletions tests/core_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,75 @@
import doctest
import os
import unittest
os.environ['CARAVEL_CONFIG'] = 'tests.caravel_test_config'
from flask.ext.testing import LiveServerTestCase, TestCase

from flask import escape

import caravel
from caravel import app, db, models, utils
from caravel import app, db, models, utils, appbuilder

os.environ['CARAVEL_CONFIG'] = 'tests.caravel_test_config'

app.config['TESTING'] = True
app.config['CSRF_ENABLED'] = False
app.config['SECRET_KEY'] = 'thisismyscretkey'
app.config['WTF_CSRF_ENABLED'] = False
BASE_DIR = app.config.get("BASE_DIR")
cli = imp.load_source('cli', BASE_DIR + "/bin/caravel")


class LiveTest(TestCase):
class CaravelTests(unittest.TestCase):

def create_app(self):
app.config['LIVESERVER_PORT'] = 8873
app.config['TESTING'] = True
return app
def __init__(self, *args, **kwargs):
super(CaravelTests, self).__init__(*args, **kwargs)
self.client = app.test_client()
role_admin = appbuilder.sm.find_role('Admin')
user = appbuilder.sm.find_user('admin')
if not user:
appbuilder.sm.add_user(
'admin', 'admin',' user', '[email protected]',
role_admin, 'general')
utils.init(caravel)
self.load_examples()

def setUp(self):
pass

def test_init(self):
utils.init(caravel)
def tearDown(self):
pass

def test_load_examples(self):
def login(self):
self.client.post(
'/login/',
data=dict(username='admin', password='general'),
follow_redirects=True)

def load_examples(self):
cli.load_examples(sample=True)

def test_slices(self):
# Testing by running all the examples
self.login()
Slc = models.Slice
urls = []
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())
urls += [
slc.slice_url,
slc.viz.json_endpoint,
]
for url in urls:
self.client.get(url)

def test_csv(self):
self.client.get('/caravel/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 test_dashboard(self):
self.login()
urls = {}
for dash in db.session.query(models.Dashboard).all():
self.client.get(dash.url)
urls[dash.dashboard_title] = dash.url
for title, url in urls.items():
print(url)
assert escape(title) in self.client.get(url).data.decode('utf-8')

def test_doctests(self):
modules = [utils]
Expand All @@ -52,12 +79,10 @@ def test_doctests(self):
if failed:
raise Exception("Failed a doctest")

def misc(self):
self.client.get('/health')
self.client.get('/ping')
def test_misc(self):
assert self.client.get('/health').data.decode('utf-8') == "OK"
assert self.client.get('/ping').data.decode('utf-8') == "OK"

def tearDown(self):
pass

if __name__ == '__main__':
unittest.main()
6 changes: 0 additions & 6 deletions tests/panoramix_test_config.py

This file was deleted.

0 comments on commit 2086607

Please sign in to comment.