def test_reload_procfile_remove_old_cmds(self): plugin = ProcfileWatcher("", "", 1) plugin.call = Mock() plugin.call.return_value = {"statuses": {"name": "name", "cmd": "cmd"}} plugin.procfile_path = os.path.join(os.path.dirname(__file__), "testdata/Procfile2") plugin.reload_procfile() plugin.call.assert_called_with("rm", name="name")
def test_reload_procfile_remove_old_cmds(self): plugin = ProcfileWatcher("", "", 1) plugin.call = Mock() plugin.call.return_value = {"statuses": {"name": "name", "cmd": "cmd"}} plugin.procfile_path = os.path.join(os.path.dirname(__file__), "testdata/Procfile2") plugin.reload_procfile() plugin.call.assert_called_with("rm", name="name")
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_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_reload_procfile_update_cmds(self): plugin = ProcfileWatcher("", "", 1) plugin.call = Mock() plugin.call.return_value = {"statuses": {"name": "name", "cmd": "cmd"}} plugin.get_cmd = Mock() plugin.get_cmd.return_value = "cmd" plugin.procfile_path = os.path.join(os.path.dirname(__file__), "testdata/Procfile3") plugin.reload_procfile() plugin.get_cmd.assert_called_with("name") plugin.call.assert_called_with("set", name="name", options={'cmd': 'cmd2'})
def test_reload_procfile_update_cmds(self): plugin = ProcfileWatcher("", "", 1) plugin.call = Mock() plugin.call.return_value = {"statuses": {"name": "name", "cmd": "cmd"}} plugin.get_cmd = Mock() plugin.get_cmd.return_value = "cmd" plugin.procfile_path = os.path.join(os.path.dirname(__file__), "testdata/Procfile3") plugin.reload_procfile() plugin.get_cmd.assert_called_with("name") plugin.call.assert_called_with("set", name="name", options={'cmd': 'cmd2'})