diff --git a/api_test.py b/api_test.py index 0330c91..01c8a7c 100755 --- a/api_test.py +++ b/api_test.py @@ -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 # diff --git a/full_run_rand.yaml b/full_run_rand.yaml index 22ef6c2..e933108 100644 --- a/full_run_rand.yaml +++ b/full_run_rand.yaml @@ -82,4 +82,4 @@ step17: payload: plugin: bibles step18: - name: load_service_sequential + name: load_service_random diff --git a/full_run_seq.yaml b/full_run_seq.yaml index e933108..49c4e5f 100644 --- a/full_run_seq.yaml +++ b/full_run_seq.yaml @@ -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 diff --git a/test_api/apitest/callbacks.py b/test_api/apitest/callbacks.py index dee7a36..cdadcda 100644 --- a/test_api/apitest/callbacks.py +++ b/test_api/apitest/callbacks.py @@ -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: diff --git a/test_api/apitest/constants.py b/test_api/apitest/constants.py index f9865c5..01dc1f1 100644 --- a/test_api/apitest/constants.py +++ b/test_api/apitest/constants.py @@ -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 # diff --git a/test_api/apitest/logger.py b/test_api/apitest/logger.py index 77fc1fe..fe9a49c 100644 --- a/test_api/apitest/logger.py +++ b/test_api/apitest/logger.py @@ -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 # diff --git a/test_api/apitest/runner.py b/test_api/apitest/runner.py index ee227c8..c21befc 100644 --- a/test_api/apitest/runner.py +++ b/test_api/apitest/runner.py @@ -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() diff --git a/test_api/apitest/task.py b/test_api/apitest/task.py index e9a4558..2e9f5cd 100644 --- a/test_api/apitest/task.py +++ b/test_api/apitest/task.py @@ -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 # diff --git a/test_api/apitest/zero.py b/test_api/apitest/zero.py index 40369c0..aa96a89 100644 --- a/test_api/apitest/zero.py +++ b/test_api/apitest/zero.py @@ -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 # diff --git a/test_api/runner.py b/test_api/runner.py index f41ab70..270b5ca 100644 --- a/test_api/runner.py +++ b/test_api/runner.py @@ -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 #