Permalink
Browse files

Fix tests

  • Loading branch information...
1 parent 791f2e0 commit 766840de685436887378a2e52cb244a73fd8aef0 @arikfr arikfr committed Feb 22, 2014
Showing with 7 additions and 7 deletions.
  1. +1 −1 tests/__init__.py
  2. +6 −6 tests/test_controllers.py
View
@@ -2,7 +2,7 @@
from redash import settings, db, app
import redash.models
-# TODO: this isn't pretty... :-)
+# TODO: this isn't pretty...
settings.DATABASE_CONFIG = {
'name': 'circle_test',
'engine': 'peewee.PostgresqlDatabase',
View
@@ -125,13 +125,13 @@ def test_get_non_existint_dashbaord(self):
self.assertEquals(rv.status_code, 404)
def test_create_new_dashboard(self):
- user_email = 'test@example.com'
- with app.test_client() as c, authenticated_user(c, user=user_factory.create(email=user_email)):
+ user = user_factory.create()
+ with app.test_client() as c, authenticated_user(c, user=user):
dashboard_name = 'Test Dashboard'
rv = json_request(c.post, '/api/dashboards', data={'name': dashboard_name})
self.assertEquals(rv.status_code, 200)
self.assertEquals(rv.json['name'], 'Test Dashboard')
- self.assertEquals(rv.json['user'], user_email)
+ self.assertEquals(rv.json['user_id'], user.id)
self.assertEquals(rv.json['layout'], [])
def test_update_dashboard(self):
@@ -224,19 +224,19 @@ def test_update_query(self):
self.assertEquals(rv.json['name'], 'Testing')
def test_create_query(self):
- user = 'test@example.com'
+ user = user_factory.create()
query_data = {
'name': 'Testing',
'query': 'SELECT 1',
'ttl': 3600
}
- with app.test_client() as c, authenticated_user(c, user=user_factory.create(email=user)):
+ with app.test_client() as c, authenticated_user(c, user=user):
rv = json_request(c.post, '/api/queries', data=query_data)
self.assertEquals(rv.status_code, 200)
self.assertDictContainsSubset(query_data, rv.json)
- self.assertEquals(rv.json['user'], user)
+ self.assertEquals(rv.json['user']['id'], user.id)
self.assertIsNotNone(rv.json['api_key'])
self.assertIsNotNone(rv.json['query_hash'])

0 comments on commit 766840d

Please sign in to comment.