def test_should_replace_cmds_with_environ_with_braces(self): plugin = ProcfileWatcher("", "", 1) plugin.envs = lambda: {} plugin.circus_client = Mock() name = "name" cmd = "echo ${PORT}" options = self.build_options(name, "echo 8888") plugin.add_watcher(name=name, cmd=cmd) plugin.circus_client.call.assert_called_with(options)
def test_add_watcher(self): plugin = ProcfileWatcher("", "", 1) plugin.envs = lambda: {} plugin.circus_client = Mock() name = "name" cmd = "cmd" options = self.build_options(name, cmd) plugin.add_watcher(name=name, cmd=cmd) plugin.circus_client.call.assert_called_with(options)
def test_reload_procfile_add_new_cmds(self): plugin = ProcfileWatcher("", "", 1) plugin.procfile_path = os.path.join(os.path.dirname(__file__), "testdata/Procfile1") plugin.circus_client = Mock() plugin.envs = lambda: {} plugin.call = Mock() plugin.call.return_value = {"statuses": {}} plugin.reload_procfile() options = self.build_options("name", "cmd") plugin.circus_client.call.assert_called_with(options)
def test_change_cmd_should_replace_cmds_with_environ(self, load_envs): load_envs.return_value = {"BLE": "bla"} plugin = ProcfileWatcher("", "", 1) plugin.envs = lambda: {} plugin.call = Mock() plugin.port = 8888 name = "name" cmd = "echo ${PORT} ${BLE}" plugin.change_cmd(name=name, cmd=cmd) plugin.call.assert_called_with('set', options={'cmd': 'echo 8888 bla'}, name=name)
def test_change_cmd_should_replace_cmds_with_environ(self, load_envs): load_envs.return_value = {"BLE": "bla"} plugin = ProcfileWatcher("", "", 1) plugin.envs = lambda: {} plugin.call = Mock() plugin.port = 8888 name = "name" cmd = "echo ${PORT} ${port} ${BLE}" plugin.change_cmd(name=name, cmd=cmd) plugin.call.assert_called_with('set', options={'cmd': 'echo 8888 8888 bla'}, name=name)