6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-11-16 01:57:16 +00:00
tutor/tests/test_utils.py
Régis Behmo 993694909a Fix forum depends_on when data services are disabled
When both mongodb and elasticsearch were not activated, there was a
syntax error in the local docker-compose.yml file.

Close #266
2019-11-22 09:21:59 +01:00

25 lines
805 B
Python

import unittest
from tutor import utils
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"))
def test_list_if(self):
self.assertEqual('["cms"]', utils.list_if([("lms", False), ("cms", True)]))