mirror of
https://gitlab.com/openlp/openlp_api_tester.git
synced 2024-11-24 04:44:23 +00:00
Merge branch 'updates' into 'master'
Updates to version 0.4 See merge request openlp/openlp_api_tester!9
This commit is contained in:
commit
a324e3c87c
@ -1,3 +1,4 @@
|
||||
python3-colorama==0.4.3
|
||||
websocket-client==0.57.0
|
||||
|
||||
websocket-client~=1.2.3
|
||||
zeroconf~=0.36.9
|
||||
colorama~=0.4.4
|
||||
requests~=2.27.0
|
||||
|
13
scripts/alert.json
Normal file
13
scripts/alert.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"process_name": "Show basic alert process",
|
||||
"step1": {"active": true,
|
||||
"name": "trigger_alert",
|
||||
"min": 0,
|
||||
"payload": { "text": "Some Text" }
|
||||
},
|
||||
"step2": {"active": true,
|
||||
"name": "trigger_alert",
|
||||
"delay": 5,
|
||||
"payload": { "text": "Some more text Text" }
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
---
|
||||
process_name: Show basic alert process
|
||||
step1:
|
||||
payload:
|
||||
text: Show some text
|
||||
name: trigger_alert
|
35
scripts/blank.json
Normal file
35
scripts/blank.json
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"process_name": "Test Display hiding",
|
||||
"step1": {"active": true,
|
||||
"name": "display_hide",
|
||||
"delay": 1
|
||||
},
|
||||
"step2": {"active": true,
|
||||
"name": "display_show",
|
||||
"delay": 1
|
||||
},
|
||||
"step3": {"active": true,
|
||||
"name": "display_blank",
|
||||
"delay": 1
|
||||
},
|
||||
"step4": {"active": true,
|
||||
"name": "display_show",
|
||||
"delay": 1
|
||||
},
|
||||
"step5": {"active": true,
|
||||
"name": "display_theme",
|
||||
"delay": 1
|
||||
},
|
||||
"step6": {"active": true,
|
||||
"name": "display_show",
|
||||
"delay": 1
|
||||
},
|
||||
"step7": {"active": true,
|
||||
"name": "display_desktop",
|
||||
"delay": 1
|
||||
},
|
||||
"step8": {"active": true,
|
||||
"name": "display_show",
|
||||
"delay": 1
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
---
|
||||
process_name: Test Display hiding
|
||||
step1:
|
||||
delay: 1
|
||||
name: display_hide
|
||||
step2:
|
||||
delay: 1
|
||||
name: display_show
|
||||
step3:
|
||||
delay: 1
|
||||
name: display_blank
|
||||
step4:
|
||||
delay: 1
|
||||
name: display_show
|
||||
step5:
|
||||
delay: 1
|
||||
name: display_theme
|
||||
step6:
|
||||
delay: 1
|
||||
name: display_show
|
||||
step7:
|
||||
delay: 1
|
||||
name: display_desktop
|
||||
step8:
|
||||
delay: 1
|
||||
name: display_show
|
104
scripts/full_run_rand.json
Normal file
104
scripts/full_run_rand.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"process_name": "Test Process Service Random",
|
||||
"step1": {"active": true,
|
||||
"name": "clear_live_controller",
|
||||
"max": 1,
|
||||
"min": 1
|
||||
},
|
||||
"step2": {"active": true,
|
||||
"name": "clear_preview_controller",
|
||||
"delay": 1
|
||||
},
|
||||
"step3": {"active": true,
|
||||
"name": "new_service",
|
||||
"max": 1,
|
||||
"min": 1
|
||||
},
|
||||
"step4": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "songs"
|
||||
}
|
||||
},
|
||||
"step5": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "bibles"
|
||||
}
|
||||
},
|
||||
"step6": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "bibles"
|
||||
}
|
||||
},
|
||||
"step7": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {"active": true,
|
||||
"plugin": "custom"
|
||||
}
|
||||
},
|
||||
"step8": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "images"
|
||||
}
|
||||
},
|
||||
"step9": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "songs"
|
||||
}
|
||||
},
|
||||
"step10": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "bibles"
|
||||
}
|
||||
},
|
||||
"step11": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "bibles"
|
||||
}
|
||||
},
|
||||
"step12": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "songs"
|
||||
}
|
||||
},
|
||||
"step13": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "custom"
|
||||
}
|
||||
},
|
||||
"step14": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "bibles"
|
||||
}
|
||||
},
|
||||
"step15": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "songs"
|
||||
}
|
||||
},
|
||||
"step16": {"active": true,
|
||||
"name": "load_service_random"
|
||||
}
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
---
|
||||
process_name: test process
|
||||
step1:
|
||||
max: 1
|
||||
min: 1
|
||||
name: clear_live_controller
|
||||
step2:
|
||||
delay: 1
|
||||
name: clear_preview_controller
|
||||
step3:
|
||||
max: 1
|
||||
min: 1
|
||||
name: new_service
|
||||
step4:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: songs
|
||||
step5:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: songs
|
||||
step6:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: bibles
|
||||
step7:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: bibles
|
||||
step8:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: custom
|
||||
step9:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: images
|
||||
step10:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: songs
|
||||
step11:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: presentation
|
||||
step12:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: bibles
|
||||
step13:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: bibles
|
||||
step14:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: songs
|
||||
step15:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: custom
|
||||
step16:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: bibles
|
||||
step17:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: bibles
|
||||
step18:
|
||||
name: load_service_random
|
104
scripts/full_run_seq.json
Normal file
104
scripts/full_run_seq.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"process_name": "Test Process Service Sequential",
|
||||
"step1": {"active": true,
|
||||
"name": "clear_live_controller",
|
||||
"max": 1,
|
||||
"min": 1
|
||||
},
|
||||
"step2": {"active": true,
|
||||
"name": "clear_preview_controller",
|
||||
"delay": 1
|
||||
},
|
||||
"step3": {"active": true,
|
||||
"name": "new_service",
|
||||
"max": 1,
|
||||
"min": 1
|
||||
},
|
||||
"step4": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "songs"
|
||||
}
|
||||
},
|
||||
"step5": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "bibles"
|
||||
}
|
||||
},
|
||||
"step6": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "bibles"
|
||||
}
|
||||
},
|
||||
"step7": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "custom"
|
||||
}
|
||||
},
|
||||
"step8": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "images"
|
||||
}
|
||||
},
|
||||
"step9": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "songs"
|
||||
}
|
||||
},
|
||||
"step10": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "bibles"
|
||||
}
|
||||
},
|
||||
"step11": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "bibles"
|
||||
}
|
||||
},
|
||||
"step12": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "songs"
|
||||
}
|
||||
},
|
||||
"step13": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "custom"
|
||||
}
|
||||
},
|
||||
"step14": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "bibles"
|
||||
}
|
||||
},
|
||||
"step15": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "songs"
|
||||
}
|
||||
},
|
||||
"step16": {"active": true,
|
||||
"name": "load_service_sequential"
|
||||
}
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
---
|
||||
process_name: test process
|
||||
step1:
|
||||
max: 1
|
||||
min: 1
|
||||
name: clear_live_controller
|
||||
step2:
|
||||
delay: 1
|
||||
name: clear_preview_controller
|
||||
step3:
|
||||
max: 1
|
||||
min: 1
|
||||
name: new_service
|
||||
step4:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: songs
|
||||
step5:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: songs
|
||||
step6:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: bibles
|
||||
step7:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: bibles
|
||||
step8:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: custom
|
||||
step9:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: images
|
||||
step10:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: songs
|
||||
step12:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: bibles
|
||||
step13:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: bibles
|
||||
step14:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: songs
|
||||
step15:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: custom
|
||||
step16:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: bibles
|
||||
step17:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: bibles
|
||||
step18:
|
||||
name: load_service_sequential
|
6
scripts/live_item.json
Normal file
6
scripts/live_item.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"process_name": "live_item",
|
||||
"step1": {"active": true,
|
||||
"name": "play_live_items"
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
process_name: live_item
|
||||
step1:
|
||||
name: play_live_items
|
29
scripts/media.json
Normal file
29
scripts/media.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"process_name": "play media",
|
||||
"step1": {"active": true,
|
||||
"name": "clear_live_controller",
|
||||
"max": 1,
|
||||
"min": 1
|
||||
},
|
||||
"step2": {"active": true,
|
||||
"name": "clear_preview_controller",
|
||||
"delay": 1
|
||||
},
|
||||
"step3": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 10,
|
||||
"payload": {
|
||||
"plugin": "media"
|
||||
}
|
||||
},
|
||||
"step4": {"active": true,
|
||||
"name": "load_service_sequential"
|
||||
},
|
||||
"step5": {"active": true,
|
||||
"name": "flush_pending",
|
||||
"delay": 30
|
||||
},
|
||||
"step6": {"active": true,
|
||||
"name": "media_pause"
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
---
|
||||
process_name: play media
|
||||
step1:
|
||||
max: 1
|
||||
min: 1
|
||||
name: clear_live_controller
|
||||
step2:
|
||||
delay: 1
|
||||
name: clear_preview_controller
|
||||
step3:
|
||||
delay: 10
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: media
|
||||
step4:
|
||||
name: load_service_sequential
|
||||
step5:
|
||||
delay: 30
|
||||
name: flush_pending
|
||||
step6:
|
||||
name: media_pause
|
6
scripts/pause.json
Normal file
6
scripts/pause.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"process_name": "Pause Media",
|
||||
"step1": {"active": true,
|
||||
"name": "media_pause",
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
process_name: Pause Media
|
||||
step1:
|
||||
name: media_pause
|
6
scripts/play.json
Normal file
6
scripts/play.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"process_name": "Play Media",
|
||||
"step1": {"active": true,
|
||||
"name": "media_play",
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
process_name: Play Media
|
||||
step1:
|
||||
name: media_play
|
6
scripts/stop.json
Normal file
6
scripts/stop.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"process_name": "Stop Media",
|
||||
"step1": {"active": true,
|
||||
"name": "media_stop",
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
process_name: Stop Media
|
||||
step1:
|
||||
name: media_stop
|
32
scripts/test.json
Normal file
32
scripts/test.json
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"process_name": "play media",
|
||||
"step1": {"active": true,
|
||||
"name": "clear_live_controller",
|
||||
"max": 1,
|
||||
"min": 1
|
||||
},
|
||||
"step2": {"active": true,
|
||||
"name": "clear_preview_controller",
|
||||
"delay": 1
|
||||
},
|
||||
"step3": {"active": true,
|
||||
"name": "new_service",
|
||||
"max": 1,
|
||||
"min": 1
|
||||
},
|
||||
"step4": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {
|
||||
"plugin": "songs"
|
||||
}
|
||||
},
|
||||
"step5": {"active": true,
|
||||
"name": "search_and_add",
|
||||
"delay": 1,
|
||||
"payload": {"plugin": "bibles" }
|
||||
},
|
||||
"step6": {"active": true,
|
||||
"name": "load_service_sequential"
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
---
|
||||
process_name: test process
|
||||
step1:
|
||||
max: 1
|
||||
min: 1
|
||||
name: clear_live_controller
|
||||
step2:
|
||||
delay: 1
|
||||
name: clear_preview_controller
|
||||
step3:
|
||||
max: 1
|
||||
min: 1
|
||||
name: new_service
|
||||
step4:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: songs
|
||||
step5:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: bibles
|
||||
step6:
|
||||
name: load_service_sequential
|
15
scripts/themes.json
Normal file
15
scripts/themes.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"process_name": "Themes",
|
||||
"step1": {"active": true,
|
||||
"name": "set_theme_level",
|
||||
"payload": { "theme_level": "global" }
|
||||
},
|
||||
"step2": {"active": true,
|
||||
"delay": 2,
|
||||
"name": "change_default_theme"
|
||||
},
|
||||
"step3": {"active": true,
|
||||
"delay": 2,
|
||||
"name": "change_default_theme"
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
process_name: themes
|
||||
step1:
|
||||
name: loop_theme_default
|
@ -226,11 +226,16 @@ def get_live_image(rtc: object) -> None:
|
||||
assert ret.status_code == 204, ret.status_code
|
||||
|
||||
|
||||
def loop_theme_default(rtc: object) -> None:
|
||||
def change_default_theme(rtc: object) -> None:
|
||||
print_text('loop_theme_default')
|
||||
items = get_themes(rtc)
|
||||
for item in json.loads(items.text):
|
||||
print(item)
|
||||
default = get_default_theme(rtc)
|
||||
first = None
|
||||
for item in json.loads(items):
|
||||
if item['name'].replace("\"", "") != default and first is None:
|
||||
first = item['name']
|
||||
set_theme(rtc, first)
|
||||
|
||||
# items = requests.get(rtc.base_url + 'service/items')
|
||||
# service = json.loads(items.text)
|
||||
# limit = len(service)
|
||||
@ -241,17 +246,18 @@ def loop_theme_default(rtc: object) -> None:
|
||||
# rtc.pending.append(Task(rtc, pl))
|
||||
|
||||
|
||||
def get_themes(rtc: object) -> str:
|
||||
def get_themes(rtc: object) -> list:
|
||||
print_text('get_themes')
|
||||
ret = requests.get(rtc.base_url + 'controller/themes')
|
||||
assert ret.status_code == 200, ret.status_code
|
||||
return ret.text
|
||||
|
||||
|
||||
def get_default_theme(rtc: object) -> None:
|
||||
def get_default_theme(rtc: object) -> str:
|
||||
print_text('get_default_theme')
|
||||
ret = requests.get(rtc.base_url + 'controller/theme')
|
||||
assert ret.status_code == 204, ret.status_code
|
||||
assert ret.status_code == 200, ret.status_code
|
||||
return ret.text.replace("\"", "").replace("\n", "")
|
||||
|
||||
|
||||
def get_themes_name(rtc: object, payload: dict) -> None:
|
||||
@ -259,6 +265,7 @@ def get_themes_name(rtc: object, payload: dict) -> None:
|
||||
print_text('get_themes_name')
|
||||
ret = requests.get(rtc.base_url + f'themes/{t_name}')
|
||||
assert ret.status_code == 204, ret.status_code
|
||||
return ret.text
|
||||
|
||||
|
||||
def get_live_theme(rtc: object) -> None:
|
||||
@ -269,21 +276,22 @@ def get_live_theme(rtc: object) -> None:
|
||||
|
||||
def get_theme_level(rtc: object) -> None:
|
||||
print_text('get_theme_level')
|
||||
ret = requests.get(rtc.base_url + 'theme_level')
|
||||
assert ret.status_code == 204, ret.status_code
|
||||
ret = requests.get(rtc.base_url + 'controller/theme')
|
||||
assert ret.status_code == 200, ret.status_code
|
||||
return ret.text
|
||||
|
||||
|
||||
def set_theme_level(rtc: object, payload: dict) -> None:
|
||||
t_level = payload['theme_level']
|
||||
print_text('set_theme_level')
|
||||
ret = requests.post(rtc.base_url + 'theme_level', json=dict(level=t_level))
|
||||
ret = requests.post(rtc.base_url + 'controller/theme-level', json=dict(level=t_level))
|
||||
assert ret.status_code == 204, ret.status_code
|
||||
return ret.text
|
||||
|
||||
|
||||
def set_theme(rtc: object, payload: dict) -> None:
|
||||
t_level = payload['theme_level']
|
||||
print_text('set_theme_level')
|
||||
ret = requests.post(rtc.base_url + 'theme_level', json=dict(level=t_level))
|
||||
def set_theme(rtc: object, theme_name: str) -> None:
|
||||
print_text('set_theme')
|
||||
ret = requests.post(rtc.base_url + 'controller/theme', json=dict(theme=theme_name))
|
||||
assert ret.status_code == 204, ret.status_code
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
import argparse
|
||||
import threading
|
||||
import websocket
|
||||
import yaml
|
||||
import json
|
||||
|
||||
from collections import deque
|
||||
from websocket import create_connection
|
||||
@ -69,7 +69,7 @@ class RunTestsController(object):
|
||||
if not conn_timeout:
|
||||
print_error("Could not connect to WS! Exiting.")
|
||||
|
||||
def on_message(self, message: str) -> None:
|
||||
def on_message(self, ws_obj: object, message: str) -> None:
|
||||
if self.debug:
|
||||
print_debug(f"Message returned: {message}")
|
||||
if not self.received:
|
||||
@ -78,15 +78,15 @@ class RunTestsController(object):
|
||||
self.ws_data.append(message)
|
||||
|
||||
@staticmethod
|
||||
def on_open() -> None:
|
||||
print_info("Socket Listener Opened")
|
||||
def on_open(ws_obj: object) -> None:
|
||||
print_info(f"Socket Listener Opened")
|
||||
|
||||
@staticmethod
|
||||
def on_close() -> None:
|
||||
def on_close(ws_obj: object) -> None:
|
||||
print_info("Socket Listener Closed")
|
||||
|
||||
@staticmethod
|
||||
def on_error(error: str) -> None:
|
||||
def on_error(ws_obj: object, error: str) -> None:
|
||||
print_error(f'WebSocket Error: {error}')
|
||||
|
||||
def load_and_check_sockets(self, first_run: bool = False) -> bool:
|
||||
@ -118,12 +118,13 @@ class RunTestsController(object):
|
||||
a = parser.parse_args()
|
||||
f_open = f'{a.rargs[0]}'
|
||||
with open(f_open, 'r') as file:
|
||||
commands = yaml.load(file, Loader=yaml.FullLoader)
|
||||
commands = json.load(file)
|
||||
for step in commands:
|
||||
if step == 'process_name':
|
||||
print_info(f'Processing file {commands[step]}')
|
||||
continue
|
||||
self.tasks.append(Task(self, commands[step]))
|
||||
if commands[step]['active'] is True:
|
||||
self.tasks.append(Task(self, commands[step]))
|
||||
self.process_queue()
|
||||
|
||||
def compare_stage(self):
|
||||
|
@ -18,7 +18,7 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
||||
##########################################################################
|
||||
import socket
|
||||
from zeroconf import ServiceBrowser, Zeroconf
|
||||
from zeroconf import ServiceBrowser, Zeroconf, ServiceInfo
|
||||
from time import sleep
|
||||
|
||||
from test_api.apitest.logger import print_info
|
||||
@ -36,12 +36,16 @@ def check_for_openlp(type: str) -> str:
|
||||
|
||||
def add_service(self, zeroconf: Zeroconf, type: str, name: str):
|
||||
info = zeroconf.get_service_info(type, name)
|
||||
# print_info(f'Service {name} added, service info: {info}')
|
||||
print_info(f'Service {name} added, service info: {info}')
|
||||
if info.name.startswith("OpenLP"):
|
||||
print_info(f'Service {name} found')
|
||||
self.port = str(info.port)
|
||||
self.address = socket.inet_ntoa(info.addresses[0])
|
||||
|
||||
@staticmethod
|
||||
def update_service(info: ServiceInfo) -> None:
|
||||
pass
|
||||
|
||||
zeroconf = Zeroconf()
|
||||
my_listener = MyListener()
|
||||
_ = ServiceBrowser(zeroconf, f'_{type}._tcp.local.', my_listener)
|
||||
|
@ -31,11 +31,14 @@ def start() -> None:
|
||||
print_text('Check OpenLP is running')
|
||||
op_address, op_http_port = check_for_openlp('http')
|
||||
if not op_http_port:
|
||||
print_error('OpenLP is not running - aborting')
|
||||
return
|
||||
print_error('OpenLP is not found - defaulting to 4316')
|
||||
op_http_port = 4316
|
||||
else:
|
||||
print_ok(f'OpenLP is running on port (http) {op_http_port}')
|
||||
_, op_ws_port = check_for_openlp('ws')
|
||||
if not op_ws_port:
|
||||
print_error('OpenLP is not found - defaulting to 4317')
|
||||
op_ws_port = 4317
|
||||
print_ok(f'OpenLP is running network Address {op_address}')
|
||||
print_ok(f'OpenLP is running on port (ws) {op_ws_port}')
|
||||
rtc = RunTestsController(op_address, op_http_port, op_ws_port)
|
||||
|
7
test_api/temp.py
Normal file
7
test_api/temp.py
Normal file
@ -0,0 +1,7 @@
|
||||
import json
|
||||
|
||||
with open('/home/tim/Projects/OpenLP/openlp_api_tester/scripts/alert.yaml', 'r') as file:
|
||||
commands = json.load(file) #, Loader=yaml.BaseLoader)
|
||||
print(commands)
|
||||
for step in commands:
|
||||
print(step)
|
Loading…
Reference in New Issue
Block a user