class TestBaseClient(unittest.TestCase): def setUp(self): self.client = BaseClient() def test_client_urlencode_query(self): query1 = "SELECT * FROM KVK;" assert(self.client._urlencode_query(query1) == "SELECT%20*%20FROM%20KVK;") query2 = "SELECT * FROM KVK WHERE naam = 'something'" assert(self.client._urlencode_query(query2) == "SELECT%20*%20FROM%20KVK%20WHERE%20naam%20=%20'something'") query3 = 'SELECT * FROM KVK WHERE naam = "something"' assert(self.client._urlencode_query(query3) == "SELECT%20*%20FROM%20KVK%20WHERE%20naam%20=%20'something'") def test_response_format(self): with pytest.raises(ValueError): self.client.setResponseFormat('unsupportedformat')
class TestBaseClient(unittest.TestCase): def setUp(self): self.client = BaseClient() def test_client_urlencode_query(self): query1 = "SELECT * FROM KVK;" assert ( self.client._urlencode_query(query1) == "SELECT%20*%20FROM%20KVK;") query2 = "SELECT * FROM KVK WHERE naam = 'something'" assert (self.client._urlencode_query(query2) == "SELECT%20*%20FROM%20KVK%20WHERE%20naam%20=%20'something'") query3 = 'SELECT * FROM KVK WHERE naam = "something"' assert (self.client._urlencode_query(query3) == "SELECT%20*%20FROM%20KVK%20WHERE%20naam%20=%20'something'") def test_response_format(self): with pytest.raises(ValueError): self.client.setResponseFormat('unsupportedformat')
def setUp(self): self.client = BaseClient()
from __future__ import print_function from OpenKVK import BaseClient client = BaseClient() client.setResponseFormat('py') print(client.query("SELECT * FROM kvk WHERE kvks = 27312152;"))