mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-11-15 01:34:14 +00:00
fe901ab9de
`quickstart` is being renamed to `launch` and deprecated in favor of
using `launch`. The `quickstart` function temporarily aliases to
`launch`. Further mentions of `quickstart` have been changed to
reference `launch` instead.
We are indicating that this change is breaking 💥 to encourage people to
migrate their scripts right away!
69 lines
2.6 KiB
Python
69 lines
2.6 KiB
Python
import os
|
|
import tempfile
|
|
import unittest
|
|
from unittest.mock import patch
|
|
|
|
from tests.helpers import temporary_root
|
|
|
|
from .base import TestCommandMixin
|
|
|
|
|
|
class LocalTests(unittest.TestCase, TestCommandMixin):
|
|
def test_local_help(self) -> None:
|
|
result = self.invoke(["local", "--help"])
|
|
self.assertIsNone(result.exception)
|
|
self.assertEqual(0, result.exit_code)
|
|
|
|
def test_local_launch_help(self) -> None:
|
|
result = self.invoke(["local", "launch", "--help"])
|
|
self.assertIsNone(result.exception)
|
|
self.assertEqual(0, result.exit_code)
|
|
|
|
def test_local_upgrade_help(self) -> None:
|
|
result = self.invoke(["local", "upgrade", "--help"])
|
|
self.assertIsNone(result.exception)
|
|
self.assertEqual(0, result.exit_code)
|
|
|
|
def test_copyfrom(self) -> None:
|
|
with temporary_root() as root:
|
|
with tempfile.TemporaryDirectory() as directory:
|
|
with patch("tutor.utils.docker_compose") as mock_docker_compose:
|
|
self.invoke_in_root(root, ["config", "save"])
|
|
|
|
# Copy to existing directory
|
|
result = self.invoke_in_root(
|
|
root, ["local", "copyfrom", "lms", "/openedx/venv", directory]
|
|
)
|
|
self.assertIsNone(result.exception)
|
|
self.assertEqual(0, result.exit_code)
|
|
self.assertIn(
|
|
f"--volume={directory}:/tmp/mount",
|
|
mock_docker_compose.call_args[0],
|
|
)
|
|
self.assertIn(
|
|
"cp --recursive --preserve /openedx/venv /tmp/mount",
|
|
mock_docker_compose.call_args[0],
|
|
)
|
|
|
|
# Copy to non-existing directory
|
|
result = self.invoke_in_root(
|
|
root,
|
|
[
|
|
"local",
|
|
"copyfrom",
|
|
"lms",
|
|
"/openedx/venv",
|
|
os.path.join(directory, "venv2"),
|
|
],
|
|
)
|
|
self.assertIsNone(result.exception)
|
|
self.assertEqual(0, result.exit_code)
|
|
self.assertIn(
|
|
f"--volume={directory}:/tmp/mount",
|
|
mock_docker_compose.call_args[0],
|
|
)
|
|
self.assertIn(
|
|
"cp --recursive --preserve /openedx/venv /tmp/mount/venv2",
|
|
mock_docker_compose.call_args[0],
|
|
)
|