Exemplo n.º 1
0
 def test_commands(self):
     expected_commands = {
         "add-url": add_url,
         "add-watcher": add_watcher,
         "remove-url": remove_url,
         "remove-watcher": remove_watcher,
     }
     for key, cmd in expected_commands.items():
         self.assertEqual(command(key), cmd)
 def test_commands(self):
     expected_commands = {
         "add-url": add_url,
         "add-watcher": add_watcher,
         "remove-url": remove_url,
         "remove-watcher": remove_watcher,
     }
     for key, cmd in expected_commands.items():
         self.assertEqual(command(key), cmd)
Exemplo n.º 3
0
 def test_command_not_found(self, stderr):
     with self.assertRaises(SystemExit) as cm:
         command("waaaat")
     exc = cm.exception
     self.assertEqual(2, exc.code)
     calls = [
         mock.call("Usage: tsuru hc command [args]\n\n"),
         mock.call("Available commands:\n"),
         mock.call("  add-url\n"),
         mock.call("  add-watcher\n"),
         mock.call("  list-urls\n"),
         mock.call("  list-watchers\n"),
         mock.call("  remove-url\n"),
         mock.call("  remove-watcher\n"),
         mock.call("  help\n"),
         mock.call("\nUse tsuru hc help <commandname> to"
                   " get more details.\n"),
     ]
     self.assertEqual(calls, stderr.write.call_args_list)
 def test_command_not_found(self, stderr):
     with self.assertRaises(SystemExit) as cm:
         command("waaaat")
     exc = cm.exception
     self.assertEqual(2, exc.code)
     calls = [
         mock.call("Usage: tsuru hc command [args]\n\n"),
         mock.call("Available commands:\n"),
         mock.call("  add-url\n"),
         mock.call("  add-watcher\n"),
         mock.call("  list-urls\n"),
         mock.call("  list-watchers\n"),
         mock.call("  remove-url\n"),
         mock.call("  remove-watcher\n"),
         mock.call("  help\n"),
         mock.call("\nUse tsuru hc help <commandname> to"
                   " get more details.\n"),
     ]
     self.assertEqual(calls, stderr.write.call_args_list)