diff --git a/examples/CRUD - Authentication/docker-compose.yml b/examples/CRUD - Authentication/docker-compose.yml index 91bc2b6d..16f63650 100644 --- a/examples/CRUD - Authentication/docker-compose.yml +++ b/examples/CRUD - Authentication/docker-compose.yml @@ -4,7 +4,7 @@ services: ports: - "8080:8080" volumes: - - .:/var/www + - ./www:/var/www - ./sqlpage:/etc/sqlpage environment: DATABASE_URL: sqlite:///tmp/components.db?mode=rwc diff --git a/examples/CRUD - Authentication/test.hurl b/examples/CRUD - Authentication/test.hurl deleted file mode 120000 index 0dd017b9..00000000 --- a/examples/CRUD - Authentication/test.hurl +++ /dev/null @@ -1 +0,0 @@ -../../test.hurl \ No newline at end of file diff --git a/examples/CRUD - Authentication/test.hurl b/examples/CRUD - Authentication/test.hurl new file mode 100644 index 00000000..ec87a188 --- /dev/null +++ b/examples/CRUD - Authentication/test.hurl @@ -0,0 +1,67 @@ +# Public homepage is reachable without a session. +GET http://localhost:8080 +HTTP 200 +[Asserts] +header "Content-Type" contains "text/html" +body contains "Demo/Template CRUD with Authentication" +body not contains "An error occurred" + +# The currencies CRUD page is protected. +GET http://localhost:8080/currencies_list.sql +HTTP 302 +[Asserts] +header "Location" == "/login.sql?path=/currencies_list.sql" + +GET http://localhost:8080/login.sql?path=/currencies_list.sql +HTTP 200 +[Asserts] +body contains "Login" +body contains "Username" +body contains "Password" +body not contains "An error occurred" + +# Demo credentials from the example migration: admin/admin. +POST http://localhost:8080/create_session.sql?path=/currencies_list.sql +[FormParams] +username: admin +password: admin +HTTP 302 +[Asserts] +header "Set-Cookie" contains "session_token=" +header "Location" == "/currencies_list.sql" + +# Hurl's cookie store reuses the session_token set above. +GET http://localhost:8080/currencies_list.sql +HTTP 200 +[Asserts] +body contains "Currencies" +body contains "New Record" +body contains "RUR" +body contains "USD" +body not contains "An error occurred" + +GET http://localhost:8080/currencies_item_form.sql?id=1 +HTTP 200 +[Asserts] +body contains "Currency" +body contains "Exchange Rate to RUR" +body contains "RUR" +body not contains "An error occurred" + +GET http://localhost:8080/currencies_item_form.sql?action=INSERT +HTTP 200 +[Asserts] +body contains "Currency" +body contains "Exchange Rate to RUR" +body contains "BROWSE" +body not contains "An error occurred" + +GET http://localhost:8080/logout.sql?path=currencies_list.sql +HTTP 302 +[Asserts] +header "Location" == "currencies_list.sql" + +GET http://localhost:8080/currencies_list.sql +HTTP 302 +[Asserts] +header "Location" == "/login.sql?path=/currencies_list.sql"