@@ -4,32 +4,34 @@ Library Collections
44Library RequestsLibrary
55
66*** Variables ***
7- ${BASE }
8- ${PORT }
9- ${test_file_1 } test_file_1 .pdf
10- ${test_file_2 } test_file_2.pdf
7+ ${BASE }
8+ ${PORT }
9+ ${test_file_pdf } ../resources/test_file .pdf
10+ ${test_file_txt } ../resources/test_file.txt
1111${test_part_1 } test
1212${test_part_2 } test2
1313${BASE_URL } ${BASE } :${PORT }
14+ ${AUTH_TOKEN } none
15+ &{HEADERS } Authorization=Bearer ${AUTH_TOKEN }
1416
1517*** Keywords ***
1618Clean Up Test
1719 [Arguments] @{part }
1820 ${allowed_status } = Create List 204 404
1921 FOR ${partition } IN @{part }
20- ${response } = DELETE ${BASE_URL } /partition/${partition } expected_status=any
22+ ${response } = DELETE ${BASE_URL } /partition/${partition } headers= ${ HEADERS } expected_status=any
2123 ${status_code } = Convert To String ${response.status_code }
2224 List Should Contain Value ${allowed_status } ${status_code }
2325 END
2426
2527Get Task Status
26- [Arguments] ${task_id } ${expected_status } =200
27- ${response } = GET ${BASE_URL } /indexer/task/${task_id } expected_status=${expected_status }
28+ [Arguments] ${task_id } ${headers } = ${ HEADERS } ${ expected_status } =200
29+ ${response } = GET ${BASE_URL } /indexer/task/${task_id } headers= ${ headers } expected_status=${expected_status }
2830 RETURN ${response.json() }
2931
3032Get Extract
31- [Arguments] ${extract_id } ${expected_status } =200
32- ${response } = GET ${BASE_URL } /extract/${extract_id } expected_status=${expected_status }
33+ [Arguments] ${extract_id } ${headers } = ${ HEADERS } ${ expected_status } =200
34+ ${response } = GET ${BASE_URL } /extract/${extract_id } headers= ${ headers } expected_status=${expected_status }
3335 RETURN ${response.json() }
3436
3537Index File Non Blocking
@@ -39,42 +41,53 @@ Index File Non Blocking
3941 ${response } = POST
4042 ... ${BASE_URL } /indexer/partition/${part } /file/${id }
4143 ... files=${files }
44+ ... headers=${HEADERS }
4245 ... expected_status=${expected_status }
4346 ${response } = Set Variable ${response.json() }
4447 Should Match Regexp ${response } [task_status_url] ${BASE_URL } /indexer/task/[a-fA-F0-9]{48}
4548 RETURN ${response }
4649
4750Index File
48- [Arguments] ${file_path } ${id } ${part } ${expected_status } =201
51+ [Arguments] ${file_path } ${id } ${part } ${headers } = ${ HEADERS } ${ expected_status } =201
4952 ${file } = Get File For Streaming Upload ${file_path }
5053 ${files } = Create Dictionary file ${file }
5154 ${response } = POST
5255 ... ${BASE_URL } /indexer/partition/${part } /file/${id }
5356 ... files=${files }
57+ ... headers=${headers }
5458 ... expected_status=${expected_status }
5559 ${response } = Set Variable ${response.json() }
5660 Should Match Regexp ${response } [task_status_url] ${BASE_URL } /indexer/task/[a-fA-F0-9]{48}
5761 ${task_id } = Fetch From Right ${response } [task_status_url] /
5862 Sleep 1
59- FOR ${i } IN RANGE 0 60 # 60 seconds
60- ${response } = Get Task Status ${task_id }
63+ FOR ${i } IN RANGE 0 120
64+ ${response } = Get Task Status ${task_id } headers= ${ headers }
6165 IF '${response } [task_state]' == 'COMPLETED' BREAK
6266 Sleep 1
63- IF ${i } == 59
64- Log Task '${task_id } ' is still running after 60 seconds.
67+ IF ${i } == 119
68+ Log Task '${task_id } ' is still running after 120 seconds.
6569 Log ${response }
66- Fail Task '${task_id } ' is still running after 60 seconds.
70+ Fail Task '${task_id } ' is still running after 120 seconds.
6771 END
6872 END
6973
7074Check File Exists
7175 [Arguments] ${id } ${part } ${expected_status } =200
72- ${response } = GET ${BASE_URL } /partition/check-file/${part } /file/${id } expected_status=${expected_status }
76+ ${response } = GET ${BASE_URL } /${part } /file/${id } headers=${HEADERS } expected_status=${expected_status }
77+ ${json } = Set Variable ${response.json() }
78+
7379 IF '${expected_status } ' == '200 '
74- Should Be Equal As Strings ${response.json() } File '${id } ' exists in partition '${part } '.
80+ Dictionary Should Contain Key ${json } metadata
81+ Dictionary Should Contain Key ${json } documents
82+ ${documents } = Get From Dictionary ${json } documents
83+ Should Be True ${documents } != []
84+ FOR ${doc } IN @{documents }
85+ Dictionary Should Contain Key ${doc } link
86+ END
7587 END
88+
7689 IF '${expected_status } ' == '404 '
77- Should Be Equal As Strings ${response. json() } [detail] [VDB_FILE_NOT_FOUND]: File ID '${id } ' does not exist in partition '${part } '
90+ Should Be Equal As Strings ${json } [detail] [VDB_FILE_NOT_FOUND]: File ID '${id } ' does not exist in partition '${part } '
7891 END
7992
8093Patch File
@@ -83,26 +96,27 @@ Patch File
8396 ${response } = PATCH
8497 ... ${BASE_URL } /indexer/partition/${part } /file/${id }
8598 ... data=${form_data }
99+ ... headers=${HEADERS }
86100 ... expected_status=${expected_status }
87101 IF '${expected_status } ' == '200 '
88102 Should Be Equal As Strings ${response.json() } [message] Metadata for file '${id } ' successfully updated.
89103 END
90104
91105Delete File
92106 [Arguments] ${id } ${part } =${test_part_1 } ${expected_status } =204
93- ${response } = DELETE ${BASE_URL } /indexer/partition/${part } /file/${id } expected_status=${expected_status }
107+ ${response } = DELETE ${BASE_URL } /indexer/partition/${part } /file/${id } headers= ${ HEADERS } expected_status=${expected_status }
94108 RETURN None
95109
96110Delete Partition
97111 [Arguments] ${part } ${expected_status } =204
98- ${response } = DELETE ${BASE_URL } /partition/${part } expected_status=${expected_status }
112+ ${response } = DELETE ${BASE_URL } /partition/${part } headers= ${ HEADERS } expected_status=${expected_status }
99113 RETURN None
100114
101115Get File Metadata
102116 [Arguments] ${id } ${part } &{expected_metadata_and_status }
103117 ${expected_status } = Get From Dictionary ${expected_metadata_and_status } expected_status 200
104118 ${expected_metadata } = Remove From Dictionary ${expected_metadata_and_status } expected_status
105- ${response } = GET ${BASE_URL } /partition/${part } /file/${id } expected_status=${expected_status }
119+ ${response } = GET ${BASE_URL } /partition/${part } /file/${id } headers= ${ HEADERS } expected_status=${expected_status }
106120 ${json_response } = Set Variable ${response.json() }
107121 IF '${expected_status } ' == '404 '
108122 Should Be Equal As Strings ${json_response } [detail] [VDB_FILE_NOT_FOUND]: File ID '${id } ' does not exist in partition '${part } '
@@ -116,5 +130,20 @@ Get File Metadata
116130 END
117131
118132Get Models
119- ${response } = GET ${BASE_URL } /v1/models
120- Log To Console ${response }
133+ [Arguments] ${headers } =${HEADERS }
134+ ${response } = GET ${BASE_URL } /v1/models headers=${headers }
135+ Log To Console ${response }
136+
137+ Create User
138+ [Arguments] ${display_name } ${external_user_id } ${is_admin } =false ${expected_status } =201
139+ ${form_data } = Create Dictionary
140+ ... display_name=${display_name }
141+ ... external_user_id=${external_user_id }
142+ ... is_admin=${is_admin }
143+ ${response } = POST
144+ ... ${BASE_URL } /users
145+ ... headers=${HEADERS }
146+ ... data=${form_data }
147+ ... expected_status=${expected_status }
148+ RETURN ${response.json() }
149+
0 commit comments