Example #1
0
 def test_IP21_init_odbc_client_with_host_port(self):
     host = "thehostname"
     port = 999
     c = IMSClient(datasource="whatever", imstype="ip21", host=host)
     assert c.handler.host == host
     assert c.handler.port == 10014
     c = IMSClient(datasource="whatever",
                   imstype="ip21",
                   host=host,
                   port=port)
     assert c.handler.host == host
     assert c.handler.port == port
Example #2
0
 def test_IP21_connection_string_override(self):
     connstr = "someuserspecifiedconnectionstring"
     c = IMSClient(
         datasource="whatever",
         host="host",
         imstype="ip21",
         handler_options={"connection_string": connstr},
     )
     assert c.handler.generate_connection_string() == connstr
Example #3
0
 def test_init_odbc_clients(self):
     with pytest.raises(ValueError):
         c = IMSClient("xyz")
     with pytest.raises(ValueError):
         c = IMSClient("sNa", "pi")
     with pytest.raises(ValueError):
         c = IMSClient("Ono-imS", "aspen")
     with pytest.raises(ValueError):
         c = IMSClient("ono-ims", "aspen")
     with pytest.raises(ValueError):
         c = IMSClient("sna", "pi")
     c = IMSClient("onO-iMs", "pi")
     assert isinstance(c.handler, PIHandlerODBC)
     c = IMSClient("snA", "aspen")
     assert isinstance(c.handler, AspenHandlerODBC)