2022-04-15 08:51:19 +00:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
from click.exceptions import ClickException
|
|
|
|
from tutor.commands import compose
|
|
|
|
|
|
|
|
|
|
|
|
class ComposeTests(unittest.TestCase):
|
|
|
|
def test_mount_option_parsing(self) -> None:
|
|
|
|
param = compose.MountParam()
|
|
|
|
|
|
|
|
self.assertEqual(
|
|
|
|
[("lms", "/path/to/edx-platform", "/openedx/edx-platform")],
|
|
|
|
param("lms:/path/to/edx-platform:/openedx/edx-platform"),
|
|
|
|
)
|
|
|
|
self.assertEqual(
|
|
|
|
[
|
|
|
|
("lms", "/path/to/edx-platform", "/openedx/edx-platform"),
|
|
|
|
("cms", "/path/to/edx-platform", "/openedx/edx-platform"),
|
|
|
|
],
|
|
|
|
param("lms,cms:/path/to/edx-platform:/openedx/edx-platform"),
|
|
|
|
)
|
|
|
|
self.assertEqual(
|
|
|
|
[
|
|
|
|
("lms", "/path/to/edx-platform", "/openedx/edx-platform"),
|
|
|
|
("cms", "/path/to/edx-platform", "/openedx/edx-platform"),
|
|
|
|
],
|
|
|
|
param("lms, cms:/path/to/edx-platform:/openedx/edx-platform"),
|
|
|
|
)
|
2022-04-21 15:43:44 +00:00
|
|
|
self.assertEqual(
|
|
|
|
[
|
|
|
|
("lms", "/path/to/edx-platform", "/openedx/edx-platform"),
|
|
|
|
("lms-worker", "/path/to/edx-platform", "/openedx/edx-platform"),
|
|
|
|
],
|
|
|
|
param("lms,lms-worker:/path/to/edx-platform:/openedx/edx-platform"),
|
|
|
|
)
|
2022-04-15 08:51:19 +00:00
|
|
|
with self.assertRaises(ClickException):
|
|
|
|
param("lms,:/path/to/edx-platform:/openedx/edx-platform")
|