2019-03-23 23:16:03 +00:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
from tutor import utils
|
2019-03-24 21:34:50 +00:00
|
|
|
from tutor import serialize
|
2019-03-23 23:16:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
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"))
|
2019-03-24 21:24:50 +00:00
|
|
|
|
2019-03-24 21:34:50 +00:00
|
|
|
class SerializeTests(unittest.TestCase):
|
|
|
|
|
|
|
|
def test_parse_value(self):
|
|
|
|
self.assertEqual(True, serialize.parse_value("true"))
|
|
|
|
self.assertEqual(False, serialize.parse_value("false"))
|
|
|
|
self.assertEqual(None, serialize.parse_value("null"))
|