1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-11-18 09:27:45 +00:00
nyaa/tests/test_api_handler.py

35 lines
962 B
Python
Raw Normal View History

import unittest
import json
from nyaa import api_handler, models
from tests import NyaaTestCase
from pprint import pprint
class ApiHandlerTests(NyaaTestCase):
# @classmethod
# def setUpClass(cls):
# super(ApiHandlerTests, cls).setUpClass()
# @classmethod
# def tearDownClass(cls):
# super(ApiHandlerTests, cls).tearDownClass()
def test_no_authorization(self):
""" Test that API is locked unless you're logged in """
rv = self.app.get('/api/info/1')
data = json.loads(rv.get_data())
self.assertDictEqual({'errors': ['Bad authorization']}, data)
@unittest.skip('Not yet implemented')
def test_bad_credentials(self):
""" Test that API is locked unless you're logged in """
rv = self.app.get('/api/info/1')
data = json.loads(rv.get_data())
self.assertDictEqual({'errors': ['Bad authorization']}, data)
if __name__ == '__main__':
unittest.main()