Updates to settings and config

This commit is contained in:
Tim 2021-08-21 16:06:07 +01:00
parent c7e2a1927a
commit 711d38e2cc
No known key found for this signature in database
GPG Key ID: 3D454289AF831A6D
6 changed files with 61 additions and 33 deletions

View File

@ -3,12 +3,16 @@
A command line utility to access a running OpenLP instance via it's API's and test all functionality.
It will find OpenLP on the network via ZeroConf and then using the API's build and run a service.
This harness will find a running OpenLP instance on the network via ZeroConf and then using the API's build and run a service.
After each command the results are tested to make sure the WebSockets have changed.
The API's need to be configured as insecure as this is not being tested.
Tests are mastered in JSON files and run using the framework.
## Test Structure
The bible test framework is random so some bible references will not be correct and therefore will not load! The chapter and verse numbers are random numbers!!
## Sample Test Structure
```
process_name: test process
step1:
@ -38,17 +42,17 @@ step6:
The step number, needs to be unique and in order!
* delay
* delay (optional)
How long to wait after a call has been made. Default is 2 seconds for all calls.
How long to wait after a call has been made. Default is 0.3 seconds for all calls.
* max
* max (optional)
How long to wait after a call has been made. Default is 2 seconds for all calls.
Max number of fields which will change on the Web Sockets interface.
* min
* min (optional)
How long to wait after a call has been made. Default is 2 seconds for all calls.
Max number of fields which will change on the Web Sockets interface.
* payload
@ -59,21 +63,22 @@ step6:
The step name (function name) to be called to run the step.
## Commands
## Commands and Payloads
| Rule Name | Payload |
|--------------------------|------------------------------|
| trigger_alert | text: <Some text to display> |
| clear_live_controller | |
| clear_preview_controller | |
| new_service ||
| search_and_add | plugin: <plugin name>|
| load_service_random ||
| load_service_sequential ||
| play_live_items ||
| media_play ||
| media_pause ||
| media_stop ||
| search_and_live | plugin: <plugin name>|
| service_item_show | item: item_id|
| play_live_item | ?????|
| controller_item_next |?????|
| controller_item_previous |???????|
## Adding API's and Internals
API's and their handers are defining in the callback.py file. This should be the only file that needs to change when adding new API's
The test scripts are in the scripts directory and are a pre defined set of tests.

View File

@ -0,0 +1,7 @@
{
"folders": [
{
"path": "."
}
]
}

View File

@ -1,4 +1,4 @@
---
process_name: themes
step1:
name: get theme list
name: loop_theme_default

View File

@ -208,33 +208,49 @@ def trigger_alert(rtc: object, payload: dict) -> None:
assert ret.status_code == 204, ret.status_code
def get_plugins(rtc: object, payload: dict) -> None:
def get_plugins(rtc: object) -> None:
print_text('get_plugins')
ret = requests.get(rtc.base_url + 'plugins')
assert ret.status_code == 204, ret.status_code
def get_system(rtc: object, payload: dict) -> None:
def get_system(rtc: object) -> None:
print_text('get_system')
ret = requests.get(rtc.base_url + 'system')
assert ret.status_code == 204, ret.status_code
def get_live_image(rtc: object, payload: dict) -> None:
def get_live_image(rtc: object) -> None:
print_text('get_live_image')
ret = requests.get(rtc.base_url + 'live-image')
assert ret.status_code == 204, ret.status_code
def get_themes(rtc: object, payload: dict) -> None:
def loop_theme_default(rtc: object) -> None:
print_text('loop_theme_default')
items = get_themes(rtc)
for item in json.loads(items.text):
print(item)
#items = requests.get(rtc.base_url + 'service/items')
#service = json.loads(items.text)
#limit = len(service)
#random_service = [random.randint(1, limit) for itr in range(limit)]
## test sequentially
#for item in random_service:
# pl = {'max': 1, 'min': 1, 'name': 'service_item_show', 'payload': {'item': item}}
# rtc.pending.append(Task(rtc, pl))
def get_themes(rtc: object) -> str:
print_text('get_themes')
ret = requests.get(rtc.base_url + 'themes')
assert ret.status_code == 204, ret.status_code
ret = requests.get(rtc.base_url + 'controller/themes')
assert ret.status_code == 200, ret.status_code
return ret.text
def get_theme(rtc: object, payload: dict) -> None:
print_text('get_theme')
ret = requests.get(rtc.base_url + 'theme')
def get_default_theme(rtc: object) -> None:
print_text('get_default_theme')
ret = requests.get(rtc.base_url + 'controller/theme')
assert ret.status_code == 204, ret.status_code
@ -245,13 +261,13 @@ def get_themes_name(rtc: object, payload: dict) -> None:
assert ret.status_code == 204, ret.status_code
def get_live_theme(rtc: object, payload: dict) -> None:
def get_live_theme(rtc: object) -> None:
print_text('get_live_theme')
ret = requests.get(rtc.base_url + 'live_theme')
assert ret.status_code == 204, ret.status_code
def get_theme_level(rtc: object, payload: dict) -> 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
@ -299,4 +315,3 @@ def display_desktop(rtc: object) -> None:
print_text('display_desktop')
ret = requests.post(rtc.base_url + 'core/display', json=dict(display='desktop'))
assert ret.status_code == 204, ret.status_code

View File

@ -36,8 +36,9 @@ 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])

View File

@ -31,7 +31,7 @@ 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 ')
print_error('OpenLP is not running - aborting')
return
else:
print_ok(f'OpenLP is running on port (http) {op_http_port}')