Skip to content

Commit

Permalink
Add test for Basic128Rsa15 connection
Browse files Browse the repository at this point in the history
  • Loading branch information
almetge authored and oroulet committed Aug 9, 2023
1 parent 8d8408b commit c2164b6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_crypto_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,21 @@ async def srv_crypto_one_cert(request):
# stop the server
await srv.stop()

@pytest.fixture(params=srv_crypto_params)
async def srv_crypto_all_cert_basic128rsa15(request):
# start our own server
srv = Server()
key, cert = request.param
await srv.init()
srv.set_endpoint(uri_crypto)
srv.set_security_policy([ua.SecurityPolicyType.Basic128Rsa15_Sign])
await srv.load_certificate(cert)
await srv.load_private_key(key)
await srv.start()
yield srv, cert
# stop the server
await srv.stop()


@pytest.fixture()
async def srv_no_crypto():
Expand Down Expand Up @@ -149,6 +164,17 @@ async def test_basic256(srv_crypto_all_certs):
assert await clt.nodes.objects.get_children()


async def test_basic128rsa15(srv_crypto_all_cert_basic128rsa15):
_, cert = srv_crypto_all_cert_basic128rsa15
clt = Client(uri_crypto)
print(await clt.connect_and_get_server_endpoints())
await clt.set_security_string(
f"Basic128Rsa15,Sign,{EXAMPLE_PATH / 'certificate-example.der'},{EXAMPLE_PATH / 'private-key-example.pem'},{cert}"
)
async with clt:
assert await clt.nodes.objects.get_children()


async def test_basic256_encrypt(srv_crypto_all_certs):
_, cert = srv_crypto_all_certs
clt = Client(uri_crypto)
Expand Down

0 comments on commit c2164b6

Please sign in to comment.