mirror of
https://gitlab.com/openlp/openlp_api_tester.git
synced 2024-08-31 19:23:51 +00:00
More Updates and year change
This commit is contained in:
parent
a55bac850e
commit
ac408e4912
@ -3,7 +3,7 @@
|
||||
##########################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# ---------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2020 OpenLP Developers #
|
||||
# Copyright (c) 2008-2021 OpenLP Developers #
|
||||
# ---------------------------------------------------------------------- #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
|
@ -82,4 +82,4 @@ step17:
|
||||
payload:
|
||||
plugin: bibles
|
||||
step18:
|
||||
name: load_service_sequential
|
||||
name: load_service_random
|
||||
|
@ -46,11 +46,6 @@ step10:
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: songs
|
||||
step11:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
payload:
|
||||
plugin: presentation
|
||||
step12:
|
||||
delay: 1
|
||||
name: search_and_add
|
||||
@ -82,4 +77,4 @@ step17:
|
||||
payload:
|
||||
plugin: bibles
|
||||
step18:
|
||||
name: load_service_random
|
||||
name: load_service_sequential
|
||||
|
@ -2,7 +2,7 @@
|
||||
##########################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# ---------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2020 OpenLP Developers #
|
||||
# Copyright (c) 2008-2021 OpenLP Developers #
|
||||
# ---------------------------------------------------------------------- #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
@ -137,6 +137,18 @@ def load_service_sequential(rtc: object) -> None:
|
||||
rtc.pending.append(Task(rtc, pl))
|
||||
|
||||
|
||||
def load_service_random(rtc: object) -> None:
|
||||
print_text('Load_service_sequential')
|
||||
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 service_item_show(rtc: object, payload: dict) -> None:
|
||||
print_text('Service_item_show')
|
||||
item = payload['item']
|
||||
@ -146,7 +158,7 @@ def service_item_show(rtc: object, payload: dict) -> None:
|
||||
ret = requests.post(rtc.base_url + 'service/show', json=dict(uid=id))
|
||||
assert ret.status_code == 204, ret.status_code
|
||||
if not item['plugin'] == 'media':
|
||||
pl = {'max': 1, 'min': 2, 'delay': 0.5, 'name': 'play_live_items', 'payload': {'item': item}}
|
||||
pl = {'max': 1, 'min': 2, 'delay': 0.5, 'name': 'play_live_items'}
|
||||
rtc.tasks.append(Task(rtc, pl))
|
||||
|
||||
|
||||
@ -162,12 +174,12 @@ def play_live_items(rtc: object) -> None:
|
||||
assert ret.status_code == 200, f'{ret.status_code} returned from show'
|
||||
|
||||
|
||||
def play_live_item(rtc: object) -> None:
|
||||
def play_live_item(rtc: object, payload: dict) -> None:
|
||||
print_text('Play_live_item')
|
||||
ret = requests.get(rtc.base_url + 'controller/live-item')
|
||||
assert ret.status_code == 200, f'{ret.status_code} returned from live_item'
|
||||
aa = json.loads(ret.text)
|
||||
print_text(aa)
|
||||
print_text(str(aa))
|
||||
|
||||
|
||||
def controller_item_show(rtc: object, payload: dict) -> None:
|
||||
|
@ -3,7 +3,7 @@
|
||||
##########################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# ---------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2020 OpenLP Developers #
|
||||
# Copyright (c) 2008-2021 OpenLP Developers #
|
||||
# ---------------------------------------------------------------------- #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
|
@ -3,7 +3,7 @@
|
||||
##########################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# ---------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2020 OpenLP Developers #
|
||||
# Copyright (c) 2008-2021 OpenLP Developers #
|
||||
# ---------------------------------------------------------------------- #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
|
@ -2,7 +2,7 @@
|
||||
##########################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# ---------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2020 OpenLP Developers #
|
||||
# Copyright (c) 2008-2021 OpenLP Developers #
|
||||
# ---------------------------------------------------------------------- #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
@ -48,6 +48,7 @@ class RunTestsController(object):
|
||||
self.pending = deque()
|
||||
self.ws_data = deque()
|
||||
self.base_url = f'http://{self.address}:{self.http_port}/api/v2/'
|
||||
self.debug = False
|
||||
|
||||
def connect(self) -> None:
|
||||
print_info("Starting thread")
|
||||
@ -69,7 +70,8 @@ class RunTestsController(object):
|
||||
print_error("Could not connect to WS! Exiting.")
|
||||
|
||||
def on_message(self, message: str) -> None:
|
||||
print_debug(f"Message returned: {message}")
|
||||
if self.debug:
|
||||
print_debug(f"Message returned: {message}")
|
||||
if not self.received:
|
||||
self.reserved_result_stage = message
|
||||
else:
|
||||
@ -148,28 +150,6 @@ class RunTestsController(object):
|
||||
pend = self.pending.popleft()
|
||||
self.tasks.append(pend)
|
||||
|
||||
def load_service_sequential(self) -> None:
|
||||
print_text('Load_and_process_service_sequential - old')
|
||||
items = requests.get(f'http://{self.address}:{self.http_port}/api/v2/service/items')
|
||||
service = json.loads(items.text)
|
||||
# test sequentially
|
||||
for item in service:
|
||||
if item['plugin'] == 'video':
|
||||
pass
|
||||
else:
|
||||
service_item_show(self, item)
|
||||
|
||||
def load_service_random(self) -> None:
|
||||
print_text('Load_and process_service_random - old')
|
||||
items = requests.get(f'http://{self.address}:{self.http_port}/api/v2/service/items')
|
||||
service = json.loads(items.text)
|
||||
limit = len(service)
|
||||
random_service = [random.randint(1, limit) for itr in range(limit)]
|
||||
print_error(str(random_service))
|
||||
for pos in random_service:
|
||||
item = service[pos - 1]
|
||||
service_item_show(self, item)
|
||||
|
||||
def check_websocket_changes(self, mandatory: int, optional: int) -> None:
|
||||
while len(self.ws_data) > 0:
|
||||
message = self.ws_data.popleft()
|
||||
|
@ -2,7 +2,7 @@
|
||||
##########################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# ---------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2020 OpenLP Developers #
|
||||
# Copyright (c) 2008-2021 OpenLP Developers #
|
||||
# ---------------------------------------------------------------------- #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
|
@ -2,7 +2,7 @@
|
||||
##########################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# ---------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2020 OpenLP Developers #
|
||||
# Copyright (c) 2008-2021 OpenLP Developers #
|
||||
# ---------------------------------------------------------------------- #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
|
@ -2,7 +2,7 @@
|
||||
##########################################################################
|
||||
# OpenLP - Open Source Lyrics Projection #
|
||||
# ---------------------------------------------------------------------- #
|
||||
# Copyright (c) 2008-2020 OpenLP Developers #
|
||||
# Copyright (c) 2008-2021 OpenLP Developers #
|
||||
# ---------------------------------------------------------------------- #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
|
Loading…
Reference in New Issue
Block a user