*** Settings *** Documentation Akas /load URL plain format test suite Library Collections Library OperatingSystem Library Process Library RequestsLibrary Library lib/ComplexRequests.py Test Tags core cli *** Variables *** ${BIN} release/akas ${PLAIN_KEY_FILE} tests/files/plain_keys01.txt ${PLAIN_KEY_FILE02} tests/files/plain_keys02.txt ${SHA256_KEY_FILE} tests/files/sha256_keys01.txt ${AKAS_WAIT} 1s ${URL} http://localhost:5001/load *** Test Cases *** Test AKAS /load URL: with plain format [Documentation] Load test Given Start Process ${BIN} serve --no-admin-key alias=akas And Sleep ${AKAS_WAIT} ${response} = Post File Json ... url=${URL} ... key=my-admin-key ... path=${PLAIN_KEY_FILE} ... json={"format": "plain"} Then Should Be Equal As Integers ${response.status_code} 200 And Check Auth Access key=XX-XXX And Check Auth Access key=YY-XXX status=401 ${result} = And Terminate Process akas And Should Be Equal As Integers ${result.rc} 0 And Should Contain ${result.stdout} Lines count: 5 - Keys count: 5 And Should Contain ${result.stdout} File metadata - hash ... : 5b06fe2ef2d191df07333aec5ea0c351bf5b2900cb6f7cd2f133fba22c34fd88 And Should Contain ${result.stdout} File metadata - date: And Should Contain ${result.stdout} File metadata - keys count: 5 [Teardown] Kill Akas Server Test AKAS /load URL: with plain format and hash [Documentation] Load test Given Start Process ${BIN} serve --no-admin-key alias=akas And Sleep ${AKAS_WAIT} ${response} = Post File Json ... url=${URL} ... key=my-admin-key ... path=${PLAIN_KEY_FILE} ... json={"format": "plain", "hash_input_file": "5b06fe2ef2d191df07333aec5ea0c351bf5b2900cb6f7cd2f133fba22c34fd88"} Then Should Be Equal As Integers ${response.status_code} 200 And Check Auth Access key=XX-XXX And Check Auth Access key=YY-XXX status=401 ${result} = And Terminate Process akas And Should Be Equal As Integers ${result.rc} 0 And Should Contain ${result.stdout} Lines count: 5 - Keys count: 5 And Should Contain ${result.stdout} File metadata - hash ... : 5b06fe2ef2d191df07333aec5ea0c351bf5b2900cb6f7cd2f133fba22c34fd88 And Should Contain ${result.stdout} File metadata - date: And Should Contain ${result.stdout} File metadata - keys count: 5 [Teardown] Kill Akas Server Test AKAS /load URL: with admin key, plain format and hash [Documentation] Load test Given Start Process ${BIN} serve --admin-key my-admin-key alias=akas And Sleep ${AKAS_WAIT} ${response} = Post File Json ... url=${URL} ... key=fake-key ... path=${PLAIN_KEY_FILE} ... json={"format": "plain", "hash_input_file": "5b06fe2ef2d191df07333aec5ea0c351bf5b2900cb6f7cd2f133fba22c34fd88"} Then Should Be Equal As Integers ${response.status_code} 401 ${response} = Post File Json ... url=${URL} ... key=my-admin-key ... path=${PLAIN_KEY_FILE} ... json={"format": "plain", "hash_input_file": "5b06fe2ef2d191df07333aec5ea0c351bf5b2900cb6f7cd2f133fba22c34fd88"} Then Should Be Equal As Integers ${response.status_code} 200 And Check Auth Access key=XX-XXX And Check Auth Access key=YY-XXX status=401 ${result} = And Terminate Process akas And Should Be Equal As Integers ${result.rc} 0 And Should Contain ${result.stdout} Lines count: 5 - Keys count: 5 And Should Contain ${result.stdout} File metadata - hash ... : 5b06fe2ef2d191df07333aec5ea0c351bf5b2900cb6f7cd2f133fba22c34fd88 And Should Contain ${result.stdout} File metadata - date: And Should Contain ${result.stdout} File metadata - keys count: 5 [Teardown] Kill Akas Server Test AKAS /load URL: plain load twice [Documentation] Load test Given Start Process ${BIN} serve --no-admin-key alias=akas And Sleep ${AKAS_WAIT} ${response} = Post File Json ... url=${URL} ... key=my-admin-key ... path=${PLAIN_KEY_FILE} ... json={"format": "plain", "hash_input_file": "5b06fe2ef2d191df07333aec5ea0c351bf5b2900cb6f7cd2f133fba22c34fd88"} Then Should Be Equal As Integers ${response.status_code} 200 And Check Auth Access key=XX-XXX And Check Auth Access key=ZZ-ZZZ status=401 ${response} = Post File Json ... url=${URL} ... key=my-admin-key ... path=${PLAIN_KEY_FILE02} ... json={"format": "plain", "hash_input_file": "5d007b8bb685862a47c6f438683109959745e64c45ee89425503a9516fc7a12c"} Then Should Be Equal As Integers ${response.status_code} 200 And Sleep ${AKAS_WAIT} And Check Auth Access key=XX-XXX status=401 And Check Auth Access key=ZZ-ZZZ ${result} = And Terminate Process akas And Should Be Equal As Integers ${result.rc} 0 And Should Contain ${result.stdout} Lines count: 2 - Keys count: 2 And Should Contain ${result.stdout} File metadata - hash ... : 5d007b8bb685862a47c6f438683109959745e64c45ee89425503a9516fc7a12c And Should Contain ${result.stdout} File metadata - date: And Should Contain ${result.stdout} File metadata - keys count: 2 [Teardown] Kill Akas Server Test AKAS /load URL: with plain format and wrong hash [Documentation] Load test [Tags] error Given Start Process ${BIN} serve --no-admin-key alias=akas And Sleep ${AKAS_WAIT} ${response} = Post File Json ... url=${URL} ... key=my-admin-key ... path=${PLAIN_KEY_FILE} ... json={"format": "plain", "hash_input_file": "13fcba0b3a5ab1b302f9d13617ae4eec6ae623a7fd52437dd992d5dca115e68d"} Then Should Be Equal As Integers ${response.status_code} 400 And Check Auth Access key=XX-XXX status=401 ${result} = And Terminate Process akas And Should Be Equal As Integers ${result.rc} 0 And Should Contain ${result.stdout} Hash mismatch - input hash: [Teardown] Kill Akas Server Test AKAS /load URL: with plain format and wrong hash format [Documentation] Load test [Tags] error Given Start Process ${BIN} serve --no-admin-key alias=akas And Sleep ${AKAS_WAIT} ${response} = Post File Json ... url=${URL} ... key=my-admin-key ... path=${PLAIN_KEY_FILE} ... json={"format": "plain", "hash_input_file": "13fcba0b3a5ab1b302f9d13617ae4eec6ae623a7fd52437dd992d5dca115e68da"} Then Should Be Equal As Integers ${response.status_code} 400 And Check Auth Access key=XX-XXX status=401 ${result} = And Terminate Process akas And Should Be Equal As Integers ${result.rc} 0 And Should Contain ${result.stdout} is not a valid sha-256 hash [Teardown] Kill Akas Server Test AKAS /load URL: with plain format and sha256 input file [Documentation] Load test [Tags] error Given Start Process ${BIN} serve --no-admin-key alias=akas And Sleep ${AKAS_WAIT} ${response} = Post File Json ... url=${URL} ... key=my-admin-key ... path=${SHA256_KEY_FILE} ... json={"format": "plain", "hash_input_file": "43fcba0b3a5ab1b302f9d13617ae4eec6ae623a7fd52437dd992d5dca115e68d"} Then Should Be Equal As Integers ${response.status_code} 200 And Check Auth Access key=XX-XXX status=401 ${result} = And Terminate Process akas And Should Be Equal As Integers ${result.rc} 0 And Should Contain ${result.stdout} Lines count: 5 - Keys count: 5 [Teardown] Kill Akas Server Test AKAS /load URL: with length check [Documentation] Serve test When Start Process ${BIN} serve --no-admin-key --length 6 alias=akas And Sleep ${AKAS_WAIT} ${response} = Post File Json ... url=${URL} ... key=my-admin-key ... path=${PLAIN_KEY_FILE} ... json={"format": "plain"} Then Should Be Equal As Integers ${response.status_code} 200 And Check Auth Access key=XY-ZZZ And Check Auth Access key=XX-ZZ status=401 ${result} = And Terminate Process akas And Should Contain ${result.stdout} Key length: 6 And Should Contain ${result.stdout} Lines count: 5 - Keys count: 4 [Teardown] Kill Akas Server Test AKAS /load URL: with prefix check [Documentation] Serve test When Start Process ${BIN} serve --no-admin-key --prefix XX- alias=akas And Sleep ${AKAS_WAIT} ${response} = Post File Json ... url=${URL} ... key=my-admin-key ... path=${PLAIN_KEY_FILE} ... json={"format": "plain"} Then Should Be Equal As Integers ${response.status_code} 200 And Check Auth Access key=XX-ZZ And Check Auth Access key=XY-ZZZ status=401 ${result} = And Terminate Process akas Then Should Contain ${result.stdout} Key prefix: XX- And Should Contain ${result.stdout} Lines count: 5 - Keys count: 4 [Teardown] Kill Akas Server Test AKAS /load URL: with length and prefix check [Documentation] Serve test When Start Process ${BIN} serve --no-admin-key --length 6 --prefix XX- alias=akas And Sleep ${AKAS_WAIT} ${response} = Post File Json ... url=${URL} ... key=my-admin-key ... path=${PLAIN_KEY_FILE} ... json={"format": "plain"} Then Should Be Equal As Integers ${response.status_code} 200 And Check Auth Access key=XX-XXX ${result} = And Terminate Process akas Then Should Contain ${result.stdout} Key length: 6 And Should Contain ${result.stdout} Key prefix: XX- And Should Contain ${result.stdout} Lines count: 5 - Keys count: 3 [Teardown] Kill Akas Server Test AKAS /load URL: no authorization bearer [Documentation] Load test [Tags] error Given Start Process ${BIN} serve --no-admin-key alias=akas And Sleep ${AKAS_WAIT} ${file} = Get File For Streaming Upload ${PLAIN_KEY_FILE} VAR &{dict} file=${file} When POST ${URL} files=${dict} expected_status=401 ${result} = And Terminate Process akas Then Should Be Equal As Integers ${result.rc} 0 And Should Contain ${result.stdout} AuthenticationError [Teardown] Kill Akas Server *** Keywords *** Kill Akas Server [Documentation] A keyword for killing AKAS process if any Log To Console Terminate All Processes kill=True Check Auth Access [Documentation] Check the URI /auth access [Arguments] ${key} ${status}=200 ${port}=5001 VAR &{headers}= Authorization=Bearer ${key} GET http://localhost:${port}/auth headers=${headers} expected_status=${status}