Skip to content

Instantly share code, notes, and snippets.

@nvllsvm
Created May 12, 2020 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nvllsvm/e2ab0582cb3275ac5288dede9c7b60d9 to your computer and use it in GitHub Desktop.
Save nvllsvm/e2ab0582cb3275ac5288dede9c7b60d9 to your computer and use it in GitHub Desktop.
import os
import unittest
import yarl
import aiohttp.test_utils
from jellyspine.__main__ import get_app
UPSTREAM = yarl.URL(os.environ['JELLYSPINE_UPSTREAM_URL'])
WEB_DIR = 'jellyfin-web'
class TestApp(unittest.IsolatedAsyncioTestCase):
async def asyncSetUp(self):
await super().asyncSetUp()
self.app = await get_app(UPSTREAM, WEB_DIR, 'db.json')
self.server = aiohttp.test_utils.TestServer(self.app)
self.client = aiohttp.test_utils.TestClient(self.server)
await self.client.start_server()
self.addAsyncCleanup(self.client.close)
self.addAsyncCleanup(self.app.cleanup)
async def test_unauthorized(self):
resp = await self.client.request('GET', '/Playback/BitrateTest')
self.assertEqual(resp.status, 401)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment