test_med_enterprise_dash.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import os, sys
  2. import unittest
  3. sys.path.insert(
  4. 0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../src")),
  5. )
  6. from med_enterprise_dash.__init__ import __version__
  7. from med_enterprise_dash.auth import get_cas_client
  8. from med_enterprise_dash.config import get_hostname
  9. from med_enterprise_dash.routes import get_route_root
  10. from med_enterprise_dash.server import get_session_factory
  11. from med_enterprise_dash.utils.session import has_username
  12. from med_enterprise_dash.utils.toml import get_med_config
  13. class TestVersion(unittest.TestCase):
  14. def test_version(self):
  15. assert __version__ is not None
  16. class TestConfig(unittest.TestCase):
  17. def test_toml(self):
  18. get_med_config()
  19. def test_get_hostname(self):
  20. get_hostname()
  21. class TestAuth(unittest.TestCase):
  22. def test_get_auth_client(self):
  23. get_cas_client(get_med_config())
  24. class TestRoutes(unittest.TestCase):
  25. def test_get_route_root(self):
  26. get_route_root()
  27. class TestSession(unittest.TestCase):
  28. def test_has_username(self):
  29. assert has_username("foo") == True
  30. class TestServer(unittest.TestCase):
  31. def test_get_session_factory(self):
  32. get_session_factory(get_med_config())
  33. if __name__ == "__main__":
  34. print(__name__)