コード例 #1
0
ファイル: main.py プロジェクト: Antojitos/guacamole-cli
    def test_cmd_shortener_fail(self):
        with requests_mock.Mocker() as m:
            text = '{"uri": "h/a/s/h/%s"}' % self.filename
            m.post(self.endpoint, text=text)
            text = "Error 500"
            m.post(self.shortener, text=text)

            args = ["--shortener", self.shortener, "--endpoint", self.endpoint, self.filepath]
            output = guacamole_cmd(args)
            self.assertIn("something wrong with the URL shortener service", output)
コード例 #2
0
ファイル: main.py プロジェクト: Antojitos/guacamole-cli
 def test_cmd_help(self):
     with self.assertRaises(SystemExit) as cm:
         args = ["--help"]
         guacamole_cmd(args)
     self.assertEqual(cm.exception.code, 0)
     self.assertIn("show this help message and exit", sys.stdout.getvalue())
コード例 #3
0
ファイル: main.py プロジェクト: Antojitos/guacamole-cli
 def test_cmd_endpoit_fail(self):
     args = ["--endpoint", self.endpoint, self.filepath]
     output = guacamole_cmd(args)
     self.assertIn("something wrong with the endpoint", output)
コード例 #4
0
ファイル: main.py プロジェクト: Antojitos/guacamole-cli
 def test_cmd_without_options(self):
     with self.assertRaises(SystemExit) as cm:
         guacamole_cmd()
     self.assertEqual(cm.exception.code, 2)