Skip to content

Commit 486628e

Browse files
committed
Updated to handle TKE/TKS differences
1 parent 382eb05 commit 486628e

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

tests/iot_gateway_test.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@
2525
twx_agent_name = 'Thingworx'
2626
iot_item_name ="System__Date"
2727

28-
agent_list = [
29-
[mqtt_agent_name, kepconfig.iot_gateway.MQTT_CLIENT_AGENT],
30-
[rest_agent_name, kepconfig.iot_gateway.REST_CLIENT_AGENT],
31-
[rserver_agent_name, kepconfig.iot_gateway.REST_SERVER_AGENT]
32-
]
28+
# used to test which agents are installed to test against.
29+
agent_list_avail = []
30+
31+
agent_list = []
3332

3433
agent_data = {
3534
"common.ALLTYPES_NAME": 'TempName',
@@ -71,8 +70,15 @@ def HTTPErrorHandler(err):
7170
else:
7271
print('Different Exception Received: {}'.format(err))
7372

74-
def initialize(server):
75-
pass
73+
def initialize(server: kepconfig.connection.server):
74+
try:
75+
agent_list_avail = server._config_get(server.url +"/project/_iot_gateway?content=type_definition").payload
76+
for agent in agent_list_avail['child_collections']:
77+
if agent == 'mqtt_clients': agent_list.append([mqtt_agent_name, kepconfig.iot_gateway.MQTT_CLIENT_AGENT])
78+
if agent == 'rest_clients': agent_list.append([rest_agent_name, kepconfig.iot_gateway.REST_CLIENT_AGENT])
79+
if agent == 'rest_servers': agent_list.append([rserver_agent_name, kepconfig.iot_gateway.REST_SERVER_AGENT])
80+
except Exception as err:
81+
pytest.skip("IoT gateway plug-in is not installed", allow_module_level=True)
7682

7783
def complete(server):
7884
# Delete all Agents

0 commit comments

Comments
 (0)