def test_ssl_ping(): # Test that SSL works server = RESTServer(SSLKey='server.key', SSLCert='server.crt') server.start(block=False) client = RESTClient(CACert='server.crt') assert client.ping() == 'PONG' server.stop() # Test that bad crt rejected badServer = RESTServer(SSLKey='server2.key', SSLCert='server2.crt') badServer.start(block=False) error = False try: client.ping() == '' except SSLError: error = True assert error == True badServer.stop()
def test_ssl_bad(): server = RESTServer(SSLKey="server.key", SSLCert="server.crt", portRange=[8000,9000]) server.start(block=False) client = RESTClient() error = False try: assert client.ping() == '' except ConnectionError: error = True assert error == True server.stop()
def test_ping(): server = RESTServer() server.start(block=False) client = RESTClient() assert client.ping() == 'PONG' server.stop()