From c26511584efb0a07e0d94da55cd27f9a28e4a10f Mon Sep 17 00:00:00 2001 From: Matteo Valentini Date: Tue, 7 Jan 2025 17:25:03 +0100 Subject: [PATCH] --- tests/00_webtop_install_dependences.robot | 22 ++++++++++++++++++++++ tests/api.resource | 14 ++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/00_webtop_install_dependences.robot create mode 100644 tests/api.resource diff --git a/tests/00_webtop_install_dependences.robot b/tests/00_webtop_install_dependences.robot new file mode 100644 index 0000000..5732110 --- /dev/null +++ b/tests/00_webtop_install_dependences.robot @@ -0,0 +1,22 @@ +*** Settings *** +Library SSHLibrary +Resource ./api.resource + +*** Test Cases *** +Setup internal user provider + ${response} = Run task cluster/add-internal-provider {"image":"openldap","node":1} + Set Global Variable ${openldap_module_id} ${response['module_id']} + Set Global Variable ${users_domain} domain.ns8.local + Run task module/${openldap_module_id}/configure-module {"domain":"${users_domain}","admuser":"admin","admpass":"Nethesis,1234","provision":"new-domain"} + +Check if mail is installed correctly + ${output} ${rc} = Execute Command add-module mail + ... return_rc=True + Should Be Equal As Integers ${rc} 0 + &{output} = Evaluate ${output} + Set Global Variable ${mail_module_id} ${output.module_id} + Set Global Variable ${mail_domain} ns8.local + Set Global Variable ${mail_hostname} mail.ns8.local + Run task module/${mail_module_id}/configure-module {"hostname":"${mail_hostname}","user_domain":"${users_domain}","mail_domain":"${mail_domain}"} + ... return_rc=True + Should Be Equal As Integers ${rc} 0 diff --git a/tests/api.resource b/tests/api.resource new file mode 100644 index 0000000..575bc94 --- /dev/null +++ b/tests/api.resource @@ -0,0 +1,14 @@ +*** Settings *** +Library SSHLibrary + +*** Keywords *** +Run task + [Arguments] ${action} ${input} ${decode_json}=${TRUE} ${rc_expected}=0 + ${stdout} ${stderr} ${rc} = Execute Command api-cli run ${action} --data '${input}' return_stdout=True return_stderr=True return_rc=True + Should Be Equal As Integers ${rc_expected} ${rc} Run task ${action} failed!${\n}${stderr} + IF ${decode_json} and len($stdout) > 0 + ${response} = Evaluate json.loads('''${stdout}''') modules=json + ELSE + ${response} = Set Variable ${stdout} + END + [Return] ${response}