2019-05-11 18:41:04 +00:00
|
|
|
import unittest
|
|
|
|
import unittest.mock
|
|
|
|
|
2019-05-11 22:11:44 +00:00
|
|
|
from tutor.commands import config as tutor_config
|
2019-05-11 18:41:04 +00:00
|
|
|
from tutor import scripts
|
|
|
|
|
|
|
|
|
2019-05-21 09:56:49 +00:00
|
|
|
class DummyRunner(scripts.BaseRunner):
|
|
|
|
exec = unittest.mock.Mock()
|
|
|
|
|
2019-05-11 22:11:44 +00:00
|
|
|
|
2019-05-21 09:56:49 +00:00
|
|
|
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)
|