Skip to content

Commit 6ea95eb

Browse files
committed
Strengthen CRUD auth Hurl flow
1 parent 4c0c291 commit 6ea95eb

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

examples/CRUD - Authentication/test.hurl

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ body contains "Username"
2020
body contains "Password"
2121
body not contains "An error occurred"
2222

23+
POST http://localhost:8080/create_session.sql?path=/currencies_list.sql
24+
[FormParams]
25+
username: admin
26+
password: wrong
27+
HTTP 302
28+
[Asserts]
29+
header "Location" contains "login.sql"
30+
header "Location" contains "error=1"
31+
32+
GET http://localhost:8080/currencies_list.sql
33+
HTTP 302
34+
[Asserts]
35+
header "Location" == "/login.sql?path=/currencies_list.sql"
36+
2337
# Demo credentials from the example migration: admin/admin.
2438
POST http://localhost:8080/create_session.sql?path=/currencies_list.sql
2539
[FormParams]
@@ -56,6 +70,60 @@ body contains "Exchange Rate to RUR"
5670
body contains "BROWSE"
5771
body not contains "An error occurred"
5872

73+
POST http://localhost:8080/currencies_item_dml.sql?path=currencies_list.sql&action=UPDATE
74+
[FormParams]
75+
id:
76+
name: HURLTEST
77+
to_rub: 7.89
78+
HTTP 302
79+
[Captures]
80+
currency_id: header "Location" regex "id=(\\d+)"
81+
[Asserts]
82+
header "Location" contains "currencies_list.sql"
83+
header "Location" contains "info=INSERT"
84+
85+
GET http://localhost:8080/currencies_list.sql
86+
HTTP 200
87+
[Asserts]
88+
body contains "HURLTEST"
89+
body contains "7.89"
90+
body htmlUnescape contains "currencies_item_form.sql?&path=/currencies_list.sql&id={{currency_id}}"
91+
body not contains "An error occurred"
92+
93+
POST http://localhost:8080/currencies_item_dml.sql?path=currencies_list.sql&action=UPDATE
94+
[FormParams]
95+
id: {{currency_id}}
96+
name: HURLEDITED
97+
to_rub: 8.91
98+
HTTP 302
99+
[Asserts]
100+
header "Location" contains "currencies_list.sql"
101+
header "Location" contains "id={{currency_id}}"
102+
header "Location" contains "info=UPDATE"
103+
104+
GET http://localhost:8080/currencies_item_form.sql?id={{currency_id}}
105+
HTTP 200
106+
[Asserts]
107+
body contains "HURLEDITED"
108+
body contains "8.91"
109+
body not contains "An error occurred"
110+
111+
POST http://localhost:8080/currencies_item_dml.sql?path=currencies_list.sql&action=DELETE
112+
[FormParams]
113+
id: {{currency_id}}
114+
name: HURLEDITED
115+
to_rub: 8.91
116+
HTTP 302
117+
[Asserts]
118+
header "Location" contains "currencies_list.sql"
119+
header "Location" contains "info=DELETE"
120+
121+
GET http://localhost:8080/currencies_list.sql
122+
HTTP 200
123+
[Asserts]
124+
body not contains "HURLEDITED"
125+
body not contains "An error occurred"
126+
59127
GET http://localhost:8080/logout.sql?path=currencies_list.sql
60128
HTTP 302
61129
[Asserts]

0 commit comments

Comments
 (0)