Skip to content

Commit

Permalink
Merge pull request #31 from NethServer/tests
Browse files Browse the repository at this point in the history
Add SSHLibrary to api.resource test file
  • Loading branch information
stephdl authored May 22, 2024
2 parents 1a96ba1 + 9c2d3fe commit 216c3b2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions tests/api.resource
Original file line number Diff line number Diff line change
@@ -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}
3 changes: 2 additions & 1 deletion tests/dokuwiki.robot
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*** Settings ***
Library SSHLibrary
Resource api.resource

*** Test Cases ***
Check if dokuwiki is installed correctly
Expand All @@ -10,7 +11,7 @@ Check if dokuwiki is installed correctly
Set Suite Variable ${module_id} ${output.module_id}

Check if dokuwiki can be configured
${rc} = Execute Command api-cli run module/${module_id}/configure-module --data '{"wiki_name": "mywiki","username":"admin","password":"admin","email":"[email protected]","user_full_name":"Admin","host":"dokuwiki.test.local","http2https": true,"lets_encrypt": false}'
${rc} = Execute Command api-cli run module/${module_id}/configure-module --data '{"wiki_name": "mywiki","username":"admin","password":"admin","email":"[email protected]","user_full_name":"Admin","host":"dokuwiki.test.local","http2https": true,"lets_encrypt": false, "ldap_domain": "domain.com"}'
... return_rc=True return_stdout=False
Should Be Equal As Integers ${rc} 0

Expand Down

0 comments on commit 216c3b2

Please sign in to comment.