diff --git a/luncho/blueprints/index.py b/luncho/blueprints/index.py index 6a402eb..2200a69 100644 --- a/luncho/blueprints/index.py +++ b/luncho/blueprints/index.py @@ -34,4 +34,4 @@ def show_routes(): ]) routes.sort(key=itemgetter(0)) - return jsonify(routes) + return jsonify(status='OK', api=routes) diff --git a/tests/index_tests.py b/tests/index_tests.py new file mode 100644 index 0000000..5fc0f9c --- /dev/null +++ b/tests/index_tests.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 -*- + +import unittest +import json + +from base import LunchoTests + + +class TestIndex(LunchoTests): + """Tests for the index.""" + + def setUp(self): + super(TestIndex, self).setUp() + + def tearDown(self): + super(TestIndex, self).tearDown() + + def test_self(self): + """The index must be listed in the index.""" + rv = self.get('/') + self.assertJsonOk(rv) + + response = json.loads(rv.data) + self.assertEqual(response['api'][0][0], '/') + +if __name__ == '__main__': + unittest.main()