mirror of
https://github.com/bluxmit/alnoda-workspaces.git
synced 2024-04-29 19:52:19 +12:00
51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
# -----------------------------------------------------------------------------
|
|
# Copyright (C) Jupyter Development Team
|
|
#
|
|
# Distributed under the terms of the BSD License. The full license is in
|
|
# the file COPYING, distributed as part of this software.
|
|
# -----------------------------------------------------------------------------
|
|
import requests
|
|
|
|
from ....tests.base import FormatHTMLMixin
|
|
from ....tests.base import NBViewerTestCase
|
|
|
|
|
|
class LocalFileDefaultTestCase(NBViewerTestCase):
|
|
@classmethod
|
|
def get_server_cmd(cls):
|
|
return super().get_server_cmd() + ["--localfiles=."]
|
|
|
|
def test_url(self):
|
|
## assumes being run from base of this repo
|
|
url = self.url("localfile/nbviewer/tests/notebook.ipynb")
|
|
r = requests.get(url)
|
|
self.assertEqual(r.status_code, 200)
|
|
|
|
|
|
class FormatHTMLLocalFileDefaultTestCase(LocalFileDefaultTestCase, FormatHTMLMixin):
|
|
pass
|
|
|
|
|
|
class LocalFileRelativePathTestCase(NBViewerTestCase):
|
|
@classmethod
|
|
def get_server_cmd(cls):
|
|
return super().get_server_cmd() + ["--localfiles=nbviewer"]
|
|
|
|
def test_url(self):
|
|
## assumes being run from base of this repo
|
|
url = self.url("localfile/tests/notebook.ipynb")
|
|
r = requests.get(url)
|
|
self.assertEqual(r.status_code, 200)
|
|
|
|
def test_404(self):
|
|
## assumes being run from base of this repo
|
|
url = self.url("localfile/doesntexist")
|
|
r = requests.get(url)
|
|
self.assertEqual(r.status_code, 404)
|
|
|
|
|
|
class FormatHTMLLocalFileRelativePathTestCase(
|
|
LocalFileRelativePathTestCase, FormatHTMLMixin
|
|
):
|
|
pass
|