MCPcopy Create free account
hub / github.com/FreeOpcUa/python-opcua / test_discovery

Method test_discovery

tests/tests_server.py:50–65  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

48 cls.discovery.stop()
49
50 def test_discovery(self):
51 client = Client(self.discovery.endpoint.geturl())
52 client.connect()
53 try:
54 servers = client.find_servers()
55 new_app_uri = "urn:freeopcua:python:server:test_discovery"
56 self.srv.set_application_uri(new_app_uri)
57 with RegistrationService() as regService:
58 regService.register_to_discovery(self.srv, self.discovery.endpoint.geturl(), period=0)
59 time.sleep(0.1) # let server register registration
60 new_servers = client.find_servers()
61 self.assertEqual(len(new_servers) - len(servers) , 1)
62 self.assertFalse(new_app_uri in [s.ApplicationUri for s in servers])
63 self.assertTrue(new_app_uri in [s.ApplicationUri for s in new_servers])
64 finally:
65 client.disconnect()
66
67 def test_find_servers2(self):
68 client = Client(self.discovery.endpoint.geturl())

Callers

nothing calls this directly

Calls 7

connectMethod · 0.95
find_serversMethod · 0.95
disconnectMethod · 0.95
ClientClass · 0.90
RegistrationServiceClass · 0.90
set_application_uriMethod · 0.80
register_to_discoveryMethod · 0.80

Tested by

no test coverage detected