2019-05-11 18:41:04 +00:00
|
|
|
import unittest
|
|
|
|
import unittest.mock
|
|
|
|
|
2019-05-11 19:20:09 +00:00
|
|
|
from tutor.commands.config import load_defaults
|
2019-05-11 18:41:04 +00:00
|
|
|
from tutor import env
|
|
|
|
from tutor import scripts
|
|
|
|
|
|
|
|
|
|
|
|
class ScriptsTests(unittest.TestCase):
|
|
|
|
def test_run_script(self):
|
|
|
|
config = {}
|
2019-05-11 19:20:09 +00:00
|
|
|
load_defaults(config)
|
|
|
|
rendered_script = env.render_file(config, "scripts", "create_databases.sh")
|
2019-05-11 18:41:04 +00:00
|
|
|
with unittest.mock.Mock() as run_func:
|
|
|
|
scripts.run_script(
|
|
|
|
"/tmp", config, "someservice", "create_databases.sh", run_func
|
|
|
|
)
|
|
|
|
run_func.assert_called_once_with(
|
|
|
|
"/tmp", config, "someservice", rendered_script
|
|
|
|
)
|