6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-11-15 17:47:13 +00:00
tutor/tests/test_utils.py
2019-07-10 15:22:12 +08:00

23 lines
720 B
Python

import unittest
from tutor import utils
from tutor import serialize
class UtilsTests(unittest.TestCase):
def test_common_domain(self):
self.assertEqual(
"domain.com", utils.common_domain("sub1.domain.com", "sub2.domain.com")
)
self.assertEqual(
"sub1.domain.com",
utils.common_domain("sub1.domain.com", "sub2.sub1.domain.com"),
)
self.assertEqual("com", utils.common_domain("domain1.com", "domain2.com"))
self.assertEqual(
"domain.com", utils.common_domain("sub.domain.com", "ub.domain.com")
)
def test_reverse_host(self):
self.assertEqual("com.google.www", utils.reverse_host("www.google.com"))