def test_when_server_returns_error_code(self): server = FakeJoule() error_msg = "test error" error_code = 500 server.response = error_msg server.http_code = error_code self.start_server(server) runner = CliRunner() result = runner.invoke(main, ['module', 'list']) self.assertTrue('%d' % error_code in result.output) self.assertTrue(error_msg in result.output) self.assertEqual(result.exit_code, 1) self.stop_server()
def test_when_server_returns_error_code(self): server = FakeJoule() server.response = "test error" server.http_code = 500 server.stub_annotation = True self.start_server(server) runner = CliRunner() result = runner.invoke(main, ['stream', 'annotations', 'folder/stream']) self.assertIn('500', result.output) self.assertIn("test error", result.output) self.assertEqual(result.exit_code, 1) self.stop_server()