def list_all_commands(): """List all available commands.""" all_chaos, _ = ChaosMonkey.get_all_chaos() all_groups = ChaosMonkey.get_all_groups() commands = {} for group in all_groups: commands[group] = [[c.command_str, c.description] for c in all_chaos if c.group == group] return commands
def list_all_commands(): """List all available commands.""" all_chaos, _ = ChaosMonkey.get_all_chaos() all_groups = ChaosMonkey.get_all_groups() commands = {} for group in all_groups: commands[group] = [[c.command_str, c.description] for c in all_chaos if c.group == group] return commands
def test_find_command_wrong_command(self): all_chaos, _ = ChaosMonkey.get_all_chaos() command = ChaosMonkey._find_command(all_chaos, 'foo') self.assertEqual(command, None)
def test_find_command(self): all_chaos, _ = ChaosMonkey.get_all_chaos() command = ChaosMonkey._find_command(all_chaos, 'deny-all') self.assertEqual(command.command_str, 'deny-all')
def verify_equals_to_all_chaos(self, chaos): all_chaos, _ = ChaosMonkey.get_all_chaos() self.assertEqual(sorted(all_chaos, key=lambda k: k.command_str), sorted(chaos, key=lambda k: k.command_str))
def verify_equals_to_all_chaos(self, chaos): all_chaos, _ = ChaosMonkey.get_all_chaos() self.assertEqual( sorted(all_chaos, key=lambda k: k.command_str), sorted(chaos, key=lambda k: k.command_str))