mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 01:25:16 +00:00
712fc63f93
* Normalize Flask initialization API use. * Use Flask-Talisman. * Enable HSTS when HTTPS is enforced. * More details about how CSP is formatted and write CSP directives as a string. * Use CSP frame-ancestors directive and not X-Frame-Options for embedable endpoints. * Add link to flask-talisman docs. * set remember_token cookie to be HTTP-Only and Secure * Reorganize secret key configuration to be forward thinking and backward compatible.
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
from tests import BaseTestCase
|
|
|
|
|
|
class TestQueryFavoriteResource(BaseTestCase):
|
|
def test_favorite(self):
|
|
query = self.factory.create_query()
|
|
|
|
rv = self.make_request('post', '/api/queries/{}/favorite'.format(query.id))
|
|
self.assertEqual(rv.status_code, 200)
|
|
|
|
rv = self.make_request('get', '/api/queries/{}'.format(query.id))
|
|
self.assertEqual(rv.json['is_favorite'], True)
|
|
|
|
def test_duplicate_favorite(self):
|
|
query = self.factory.create_query()
|
|
|
|
rv = self.make_request('post', '/api/queries/{}/favorite'.format(query.id))
|
|
self.assertEqual(rv.status_code, 200)
|
|
|
|
rv = self.make_request('post', '/api/queries/{}/favorite'.format(query.id))
|
|
self.assertEqual(rv.status_code, 200)
|
|
|
|
def test_unfavorite(self):
|
|
query = self.factory.create_query()
|
|
rv = self.make_request('post', '/api/queries/{}/favorite'.format(query.id))
|
|
rv = self.make_request('delete', '/api/queries/{}/favorite'.format(query.id))
|
|
self.assertEqual(rv.status_code, 200)
|
|
|
|
rv = self.make_request('get', '/api/queries/{}'.format(query.id))
|
|
self.assertEqual(rv.json['is_favorite'], False)
|
|
|
|
|
|
class TestQueryFavoriteListResource(BaseTestCase):
|
|
def test_get_favorites(self):
|
|
rv = self.make_request('get', '/api/queries/favorites')
|
|
self.assertEqual(rv.status_code, 200)
|