Browse Source

index now returns an OK along with the API

master
Julio Biason 10 years ago
parent
commit
c45a31e1d7
  1. 2
      luncho/blueprints/index.py
  2. 28
      tests/index_tests.py

2
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)

28
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()
Loading…
Cancel
Save