def testInvalidReturnCode(self): """ Test that the proper exception is thrown if the server returns bad status code """ with patch.object(requests, 'get') as mockMethod: with self.assertRaises(ResponseHTTPException): cqi = CyberQInterface("127.0.0.1") mockMethod.return_value.status_code = 500 cqi.getConfigXML()