def test_http_verbs(self): client = CurlClient() verbs = ['GET', 'PUT', 'POST', 'DELETE'] bad_verbs = ['BAD', 'IAMBAD', 'IAMSUPERBAD'] for v in verbs: try: client.make_request(v, '/') except: self.fail('Should not throw error on verb: ' + v) for v in bad_verbs: try: client.make_request(v, '/') self.fail('Should throw error on verb: ' + v) except: pass
def test_basic_command(self, mock_get): un = 'admin' pw = 'admin' pt = 9090 serv = 'demo-server' prtc = 'http' client = CurlClient(username=un, password=pw, port=pt, server=serv, proto=prtc) assert client.username == un assert client.password == pw assert client.port == pt assert client.server == serv assert client.proto == prtc output = client.make_request('GET', '/api/v1/test') assert output == res1 output = client.make_request('GET', '/api/v1/bad') assert output == res2 output = client.make_request('GET', '') assert output == res3