1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 14:54:22 +00:00

🧪 Add some more trivial tests

This commit is contained in:
Steffo 2021-10-29 03:13:25 +02:00
parent 9ca716f9f2
commit 5bbf742fc5
2 changed files with 28 additions and 3 deletions

View file

@ -648,5 +648,3 @@ class SophonInstanceDetailsTestCase(BetterAPITestCase):
"theme": "sophon", "theme": "sophon",
"version": pkg_resources.get_distribution("sophon").version, "version": pkg_resources.get_distribution("sophon").version,
}) })
# TODO: Test some more code

View file

@ -1 +1,28 @@
# Create your tests here. from django.test import TestCase
from sophon.notebooks.apache import ApacheDB
from sophon.notebooks.jupyter import generate_secure_token
# Trivial tests to satisfy exam requirements
class JupyterTestCase(TestCase):
def test_secure_token(self):
for _ in range(5):
a = generate_secure_token()
b = generate_secure_token()
self.assertNotEqual(a, b)
class ApacheTestCase(TestCase):
def test_bytes_conversion(self):
s = "hello"
b = ApacheDB.convert_to_bytes(s)
self.assertEqual(b, b"hello")
def test_bytes_pass(self):
s = b"hello"
b = ApacheDB.convert_to_bytes(s)
self.assertEqual(b, b"hello")
self.assertIs(s, b)