-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibrary_keywords.robot
50 lines (41 loc) · 1.66 KB
/
library_keywords.robot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
*** Settings ***
Resource variables.robot
Library REST
*** Keywords ***
List all books
${resp} GET ${library_base}/books
[Return] ${resp}
Setup before running Suite
[Documentation] List all book then set as suite variables a set of book details
${resp} List all books
Set Suite Variable ${book_id} ${resp['body'][0]['id']}
Set Suite Variable ${book_title} ${resp['body'][0]['title']}
Set Suite Variable ${book_author} ${resp['body'][0]['author']}
Set Suite Variable ${book_genre} ${resp['body'][0]['genre']}
Set Suite Variable ${book_checked_out} ${resp['body'][0]['checkedOut']}
Set Suite Variable ${book_id_second} ${resp['body'][13]['id']}
Search books with query parameter
[Arguments] ${query}
${resp} GET ${library_base}/books${query}
[Return] ${resp}
Loop over a list of items and verify property has expected value
[Arguments] ${list} ${property_to_check} ${value_to_check}
FOR ${element} IN @{list}
Should Be Equal ${element['${property_to_check}']} ${value_to_check}
END
Read one book
[Arguments] ${id}
GET ${library_base}/books/${id}
Create one book
[Arguments] ${body}
POST ${library_base}/books ${body}
Update one book
[Arguments] ${id} ${body}
PATCH ${library_base}/books/${id} ${body}
Remove one book
[Arguments] ${id}
DELETE ${library_base}/books/${id}
Verify error handling
[Arguments] ${message}
String response body status error
String response body message ${message}