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)
|
2019-05-29 09:14:06 +00:00
|
|
|
rendered_script = runner.render("mysql-client", "createdatabases")
|
|
|
|
runner.run("mysql-client", "createdatabases")
|
|
|
|
runner.exec.assert_called_once_with("mysql-client", rendered_script)
|