mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 14:49:59 +00:00
35 lines
962 B
Python
35 lines
962 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.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()
|