-
-
Save bronsen/509f5087b2b463d0268750bd6f236d87 to your computer and use it in GitHub Desktop.
Test Endpoints for the https://bcnrust.github.io/devbcn-workshop in Jetbrains IDE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dev": { | |
"host": "http://localhost:8000" | |
}, | |
"shuttle": { | |
"host": "https://<your-project>.shuttleapp.rs" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### health | |
GET {{host}}/health HTTP/1.1 | |
> {% | |
client.test("Health check completed successfully", function() { | |
client.assert(response.status == 200, "Wrong response status"); | |
}); | |
%} | |
### create film | |
POST {{host}}/v1/films HTTP/1.1 | |
Content-Type: application/json | |
{ | |
"title": "Death in Venice", | |
"director": "Luchino Visconti", | |
"year": 1971, | |
"poster": "https://th.bing.com/th/id/R.0d441f68f2182fd7c129f4e79f6a66ef?rik=h0j7Ecvt7NBYrg&pid=ImgRaw&r=0" | |
} | |
> {% | |
client.test("Film creation executed successfully", function() { | |
client.assert(response.status == 200, "Wrong response status"); | |
const film_id = response.body["id"] | |
client.global.set("film_id", film_id); | |
}); | |
%} | |
### update film | |
PUT {{host}}/v1/films HTTP/1.1 | |
Content-Type: application/json | |
{ | |
"id": "{{film_id}}", | |
"title": "Death in Venice", | |
"director": "Benjamin Britten", | |
"year": 1981, | |
"poster": "https://image.tmdb.org/t/p/original//tmT12hTzJorZxd9M8YJOQOJCqsP.jpg" | |
} | |
> {% | |
client.test("Updating film executed successfully", function() { | |
client.assert(response.status == 200, "Wrong response status"); | |
}); | |
%} | |
### get all films | |
GET {{host}}/v1/films HTTP/1.1 | |
> {% | |
client.test("Listing all films executed successfully", function() { | |
client.assert(response.status == 200, "Wrong response status"); | |
}); | |
%} | |
### get film | |
GET {{host}}/v1/films/{{film_id}} HTTP/1.1 | |
> {% | |
client.test("Detailing one film executed successfully", function() { | |
client.assert(response.status == 200, "Wrong response status"); | |
}); | |
%} | |
### get bad film | |
GET {{host}}/v1/films/356e42a8-e659-406f-98 HTTP/1.1 | |
> {% | |
client.test("Failing to get non-existing film executed successfully", function() { | |
client.assert(response.status == 404, "Wrong response status"); | |
}); | |
%} | |
### delete film | |
DELETE {{host}}/v1/films/{{film_id}} HTTP/1.1 | |
> {% | |
client.test("Deleting a film executed successfully", function() { | |
client.assert(response.status == 200, "Wrong response status"); | |
}); | |
%} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment