@@ -0,0 +1,2744 @@
+%22%22%22Test jinja filters.%22%22%22%0A%0Aimport unittest%0A%0Afrom flask import Flask%0A%0Afrom flask_extras import FlaskExtras%0Afrom flask_extras import decorators%0A%0Aapp = Flask('test_flask_jsondash')%0Aapp.debug = True%0Aapp.secret_key = 'Foo'%0AFlaskExtras(app)%0A%0A%0A@app.route('/xhr-custom')%0A@decorators.xhr_only(status_code=400)%0Adef foo_xhr_custom():%0A    return ''%0A%0A%0A@app.route('/xhr')%0A@decorators.xhr_only()%0Adef foo_xhr():%0A    return ''%0A%0A%0A@app.route('/args')%0A@decorators.require_args(params=%5B'foo', 'bar'%5D)%0Adef foo_args():%0A    return ''%0A%0A%0A@app.route('/cookies')%0A@decorators.require_cookies(%5B'foo'%5D)%0Adef foo_cookies():%0A    return ''%0A%0A%0A@app.route('/headers')%0A@decorators.require_headers(headers=%5B'X-Foo'%5D)%0Adef foo_headers():%0A    return ''%0A%0Aclient = app.test_client()%0A%0A%0Aclass DecoratorTest(unittest.TestCase):%0A    %22%22%22All tests for title function.%22%22%22%0A%0A%0Aclass XhsTest(DecoratorTest):%0A    %22%22%22All tests for title function.%22%22%22%0A%0A    def test_invalid_xhr_decorator(self):%0A        %22%22%22Test the function with None argument.%22%22%22%0A        with app.app_context():%0A            res = client.get('/xhr')%0A            self.assertEqual(res.status_code, 415)%0A%0A    def test_invalid_xhr_custom_decorator(self):%0A        %22%22%22Test the function with None argument.%22%22%22%0A        with app.app_context():%0A            res = client.get('/xhr-custom')%0A            self.assertEqual(res.status_code, 400)%0A%0A%0Aclass RequireArgsTest(DecoratorTest):%0A    %22%22%22All tests for title function.%22%22%22%0A%0A    def test_invalid_require_args_decorator(self):%0A        %22%22%22Test the function with None argument.%22%22%22%0A        with self.assertRaises(ValueError):%0A            with app.app_context():%0A                client.get('/args')%0A%0A    def test_valid_require_args_decorator(self):%0A        %22%22%22Test the function with None argument.%22%22%22%0A        with app.app_context():%0A            res = client.get('/args?foo=1&bar=1')%0A            self.assertEqual(res.status_code, 200)%0A%0A%0Aclass RequireCookiesTest(DecoratorTest):%0A    %22%22%22All tests for title function.%22%22%22%0A%0A    def test_invalid_require_cookies_decorator(self):%0A        %22%22%22Test the function with None argument.%22%22%22%0A        with self.assertRaises(ValueError):%0A            with app.app_context():%0A                client.get('/cookies')%0A%0A%0Aclass RequireHeadersTest(DecoratorTest):%0A    %22%22%22All tests for title function.%22%22%22%0A%0A    def test_invalid_require_headers_decorator(self):%0A        %22%22%22Test the function with None argument.%22%22%22%0A        with self.assertRaises(ValueError):%0A            with app.app_context():%0A                client.get('/headers')%0A%0A    def test_valid_require_headers_decorator(self):%0A        %22%22%22Test the function with None argument.%22%22%22%0A        with app.app_context():%0A            res = client.get('/headers', headers=%7B'X-Foo': 'Foo'%7D)%0A            self.assertEqual(res.status_code, 200)%0A

Add decorator tests