7
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-06-01 05:40:48 +00:00
tutor/tests/test_images.py
Régis Behmo 336cb79fa8 refactor: better config type checking
I stumbled upon a bug that should have been detected by the type
checking. Turns out, considering that config is of type Dict[str, Any]
means that we can use just any method on all config values -- which is
terrible. I discovered this after I set `config["PLUGINS"] = None`:
this triggered a crash when I enabled a plugin.
We resolve this by making the Config type more explicit. We also take
the opportunity to remove a few cast statements.
2021-04-18 18:02:02 +02:00

14 lines
471 B
Python

import unittest
from tutor import images
from tutor.types import Config
class ImagesTests(unittest.TestCase):
def test_get_tag(self) -> None:
config: Config = {
"DOCKER_IMAGE_OPENEDX": "registry/openedx",
"DOCKER_IMAGE_OPENEDX_DEV": "registry/openedxdev",
}
self.assertEqual("registry/openedx", images.get_tag(config, "openedx"))
self.assertEqual("registry/openedxdev", images.get_tag(config, "openedx-dev"))