mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-12-13 14:43:03 +00:00
0093198864
Instead of passing a `run_func` argument, which is clumsy, we create a BaseRunner from which local and k8s runners can inherit.
19 lines
539 B
Python
19 lines
539 B
Python
import unittest
|
|
import unittest.mock
|
|
|
|
from tutor.commands import config as tutor_config
|
|
from tutor import scripts
|
|
|
|
|
|
class DummyRunner(scripts.BaseRunner):
|
|
exec = unittest.mock.Mock()
|
|
|
|
|
|
class ScriptsTests(unittest.TestCase):
|
|
def test_run(self):
|
|
config = tutor_config.load_defaults()
|
|
runner = DummyRunner("/tmp", config)
|
|
rendered_script = runner.render("create_databases.sh")
|
|
runner.run("someservice", "create_databases.sh")
|
|
runner.exec.assert_called_once_with("someservice", rendered_script)
|