1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-23 00:30:05 +00:00
nyaa/tests/test_api_handler.py
2017-08-15 17:19:45 +03:00

35 lines
968 B
Python

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.client.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.client.get('/api/info/1')
data = json.loads(rv.get_data())
self.assertDictEqual({'errors': ['Bad authorization']}, data)
if __name__ == '__main__':
unittest.main()