*** Settings *** Documentation Akas sanity test suite Library Collections Library Process Library RequestsLibrary Test Tags core cli *** Variables *** ${BIN} release/akas ${VERSION} 0.0.0 ${PLAIN_TOKEN_FILE} tests/files/plain_token.txt ${AKAS_WAIT} 1s *** Test Cases *** Test AKAS options: [--version] option [Documentation] Sanity test ${result} = When Run Process ${BIN} --version Then Should Be Equal As Integers ${result.rc} 0 And Should Contain ${result.stdout} akas And Should Contain ${result.stdout} ${VERSION} Test AKAS options: [-V] short option [Documentation] Sanity test ${result} = When Run Process ${BIN} -V Then Should Be Equal As Integers ${result.rc} 0 And Should Contain ${result.stdout} akas And Should Contain ${result.stdout} ${VERSION} Test AKAS options: [--help] option [Documentation] Sanity test ${result} = When Run Process ${BIN} --help Then Should Be Equal As Integers ${result.rc} 0 And Should Contain ${result.stdout} AKAS: API Key Authorization Server Test AKAS options: [-h] short option [Documentation] Sanity test ${result} = When Run Process ${BIN} -h Then Should Be Equal As Integers ${result.rc} 0 And Should Contain ${result.stdout} AKAS: API Key Authorization Server Test AKAS file option: without file option [Documentation] Sanity test [Tags] error ${result} = When Run Process ${BIN} Then Should Be Equal As Integers ${result.rc} 2 And Should Contain ${result.stderr} error: the following required arguments were not provided: And Should Contain ${result.stderr} --file Test AKAS file option: with wrong file path option [Documentation] Sanity test [Tags] error ${result} = When Run Process ${BIN} --file tests/files/wrong_filename.txt Then Should Be Equal As Integers ${result.rc} 1 And Should Contain ${result.stderr} Error on reading file tests/files/wrong_filename.txt: And Should Contain ${result.stderr} No such file or directory (os error 2) Test AKAS file option: with binary file [Documentation] Sanity test [Tags] error ${result} = When Run Process ${BIN} --file tests/files/file_bin.txt Then Should Be Equal As Integers ${result.rc} 1 And Should Contain ${result.stderr} Error on reading file tests/files/file_bin.txt And Should Contain ${result.stderr} stream did not contain valid UTF-8 Test AKAS length option: negative value [Documentation] Sanity test [Tags] error ${result} = When Run Process ${BIN} --length -10 --file ${PLAIN_TOKEN_FILE} Then Should Be Equal As Integers ${result.rc} 2 And Should Contain ${result.stderr} error: unexpected argument '-1' found Test AKAS port option: default port [Documentation] Sanity test When Start Process ${BIN} --file ${PLAIN_TOKEN_FILE} alias=akas And Sleep ${AKAS_WAIT} And Check Akas End Points token=XX-XXX ${result} = And Terminate Process akas Then Should Contain ${result.stdout} Opening file ${PLAIN_TOKEN_FILE} And Should Contain ${result.stdout} Serving on http://localhost:5001 ... [Teardown] Kill Akas Server Test AKAS port option: long option [Documentation] Sanity test When Start Process ${BIN} --port 5002 --file ${PLAIN_TOKEN_FILE} alias=akas And Sleep ${AKAS_WAIT} And Check Akas End Points token=XX-XXX port=5002 ${result} = And Terminate Process akas Then Should Contain ${result.stdout} Opening file ${PLAIN_TOKEN_FILE} And Should Contain ${result.stdout} Serving on http://localhost:5002 ... [Teardown] Kill Akas Server Test AKAS port option: short option [Documentation] Sanity test When Start Process ${BIN} -p 5002 --file ${PLAIN_TOKEN_FILE} alias=akas And Sleep ${AKAS_WAIT} And Check Akas End Points token=XX-XXX port=5002 ${result} = And Terminate Process akas Then Should Contain ${result.stdout} Opening file ${PLAIN_TOKEN_FILE} And Should Contain ${result.stdout} Serving on http://localhost:5002 ... [Teardown] Kill Akas Server Test AKAS port option: negative value [Documentation] Sanity test [Tags] error ${result} = When Run Process ${BIN} --port -10 --file ${PLAIN_TOKEN_FILE} Then Should Be Equal As Integers ${result.rc} 2 And Should Contain ${result.stderr} error: unexpected argument '-1' found Test AKAS port option: 0 value [Documentation] Sanity test [Tags] error ${result} = When Run Process ${BIN} --port 0 --file ${PLAIN_TOKEN_FILE} Then Should Be Equal As Integers ${result.rc} 1 And Should Contain ${result.stderr} Error: wrong port value! *** Keywords *** Kill Akas Server [Documentation] A keyword for killing AKAS process if any Log To Console Terminate All Processes kill=True Check Akas End Points [Documentation] Check the end-points of AKAS [Arguments] ${token} ${status}=200 ${port}=5001 GET http://localhost:${port}/auth-ok expected_status=200 GET http://localhost:${port}/auth-unauthorized expected_status=401 VAR &{headers}= Authorization=Bearer ${token} GET http://localhost:${port}/auth headers=${headers} expected_status=${status}