mirror of
https://gitlab.com/openlp/openlp_api_tester.git
synced 2024-12-25 11:14:08 +00:00
Merge branch 'oct_2020' into 'master'
Oct 2020 See merge request openlp/openlp_api_tester!7
This commit is contained in:
commit
7c64e935b5
@ -3,7 +3,7 @@
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# 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 #
|
# 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 #
|
# it under the terms of the GNU General Public License as published by #
|
||||||
|
@ -82,4 +82,4 @@ step17:
|
|||||||
payload:
|
payload:
|
||||||
plugin: bibles
|
plugin: bibles
|
||||||
step18:
|
step18:
|
||||||
name: load_service_sequential
|
name: load_service_random
|
||||||
|
@ -46,11 +46,6 @@ step10:
|
|||||||
name: search_and_add
|
name: search_and_add
|
||||||
payload:
|
payload:
|
||||||
plugin: songs
|
plugin: songs
|
||||||
step11:
|
|
||||||
delay: 1
|
|
||||||
name: search_and_add
|
|
||||||
payload:
|
|
||||||
plugin: presentation
|
|
||||||
step12:
|
step12:
|
||||||
delay: 1
|
delay: 1
|
||||||
name: search_and_add
|
name: search_and_add
|
||||||
@ -82,4 +77,4 @@ step17:
|
|||||||
payload:
|
payload:
|
||||||
plugin: bibles
|
plugin: bibles
|
||||||
step18:
|
step18:
|
||||||
name: load_service_random
|
name: load_service_sequential
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# 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 #
|
# 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 #
|
# 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))
|
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:
|
def service_item_show(rtc: object, payload: dict) -> None:
|
||||||
print_text('Service_item_show')
|
print_text('Service_item_show')
|
||||||
item = payload['item']
|
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))
|
ret = requests.post(rtc.base_url + 'service/show', json=dict(uid=id))
|
||||||
assert ret.status_code == 204, ret.status_code
|
assert ret.status_code == 204, ret.status_code
|
||||||
if not item['plugin'] == 'media':
|
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))
|
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'
|
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')
|
print_text('Play_live_item')
|
||||||
ret = requests.get(rtc.base_url + 'controller/live-item')
|
ret = requests.get(rtc.base_url + 'controller/live-item')
|
||||||
assert ret.status_code == 200, f'{ret.status_code} returned from live_item'
|
assert ret.status_code == 200, f'{ret.status_code} returned from live_item'
|
||||||
aa = json.loads(ret.text)
|
aa = json.loads(ret.text)
|
||||||
print_text(aa)
|
print_text(str(aa))
|
||||||
|
|
||||||
|
|
||||||
def controller_item_show(rtc: object, payload: dict) -> None:
|
def controller_item_show(rtc: object, payload: dict) -> None:
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# 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 #
|
# 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 #
|
# it under the terms of the GNU General Public License as published by #
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# 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 #
|
# 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 #
|
# it under the terms of the GNU General Public License as published by #
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# 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 #
|
# 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 #
|
# it under the terms of the GNU General Public License as published by #
|
||||||
@ -48,6 +48,7 @@ class RunTestsController(object):
|
|||||||
self.pending = deque()
|
self.pending = deque()
|
||||||
self.ws_data = deque()
|
self.ws_data = deque()
|
||||||
self.base_url = f'http://{self.address}:{self.http_port}/api/v2/'
|
self.base_url = f'http://{self.address}:{self.http_port}/api/v2/'
|
||||||
|
self.debug = False
|
||||||
|
|
||||||
def connect(self) -> None:
|
def connect(self) -> None:
|
||||||
print_info("Starting thread")
|
print_info("Starting thread")
|
||||||
@ -69,7 +70,8 @@ class RunTestsController(object):
|
|||||||
print_error("Could not connect to WS! Exiting.")
|
print_error("Could not connect to WS! Exiting.")
|
||||||
|
|
||||||
def on_message(self, message: str) -> None:
|
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:
|
if not self.received:
|
||||||
self.reserved_result_stage = message
|
self.reserved_result_stage = message
|
||||||
else:
|
else:
|
||||||
@ -148,28 +150,6 @@ class RunTestsController(object):
|
|||||||
pend = self.pending.popleft()
|
pend = self.pending.popleft()
|
||||||
self.tasks.append(pend)
|
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:
|
def check_websocket_changes(self, mandatory: int, optional: int) -> None:
|
||||||
while len(self.ws_data) > 0:
|
while len(self.ws_data) > 0:
|
||||||
message = self.ws_data.popleft()
|
message = self.ws_data.popleft()
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# 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 #
|
# 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 #
|
# it under the terms of the GNU General Public License as published by #
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# 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 #
|
# 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 #
|
# it under the terms of the GNU General Public License as published by #
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# 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 #
|
# 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 #
|
# it under the terms of the GNU General Public License as published by #
|
||||||
|
Loading…
Reference in New Issue
Block a user