feat: genre and album populate and CRUD

This commit is contained in:
GitBluub
2022-10-25 17:14:47 +09:00
committed by Bluub
parent 5cef277f40
commit 6975144e35
20 changed files with 643 additions and 7 deletions
+129
View File
@@ -0,0 +1,129 @@
*** Settings ***
Documentation Tests of the /album route.
... Ensures that the album CRUD works corectly.
Resource ../rest.resource
*** Test Cases ***
Create a album
[Documentation] Create a album
&{res}= POST
... /album
... {"name": "Mama mia"}
Output
Integer response status 201
[Teardown] DELETE /album/${res.body.id}
Create a album with an artist
[Documentation] Create a album with an artist
&{artistRes}= POST
... /artist
... {"name": "Mama mia"}
&{res}= POST
... /album
... {"name": "Mama mia", "artist": ${artistRes.body.id}}
Output
Integer response status 201
[Teardown] Run Keywords DELETE /artist/${artistRes.body.id}
... AND DELETE /album/${res.body.id}
Duplicate a album
[Documentation] Duplicate a album
&{res}= POST
... /album
... {"name": "Mama mia"}
Output
Integer response status 201
&{res2}= POST
... /album
... {"name": "Mama mia"}
Output
Integer response status 409
Should Be Equal ${res.body.id} ${res2.body.id}
[Teardown] DELETE /album/${res.body.id}
Find a album
[Documentation] Create a album and find it
&{res}= POST
... /album
... {"name": "Mama mia"}
Output
Integer response status 201
&{get}= GET /album/${res.body.id}
Output
Integer response status 200
Should Be Equal ${res.body} ${get.body}
[Teardown] DELETE /album/${res.body.id}
Find a album non existant
[Documentation] Find non existant album
&{get}= GET /album/9999
Integer response status 404
Find multiples albums
[Documentation] Create two albums and find them
&{res}= POST
... /album
... {"name": "Mama mia"}
Output
Integer response status 201
&{res2}= POST
... /album
... {"name": "Toto"}
Output
Integer response status 201
&{get}= GET /album
Output
Integer response status 200
Should Contain ${get.body.data} ${res.body}
Should Contain ${get.body.data} ${res2.body}
[Teardown] Run Keywords DELETE /album/${res.body.id}
... AND DELETE /album/${res2.body.id}
Find multiples albums filtered
[Documentation] Create two albums and find them
&{res}= POST
... /album
... {"name": "Mamamia"}
Output
Integer response status 201
&{res2}= POST
... /album
... {"name": "jkgnsg"}
Output
Integer response status 201
&{get}= GET /album?name=Mamamia
Output
Integer response status 200
Should Contain ${get.body.data} ${res.body}
Should Not Contain ${get.body.data} ${res2.body}
[Teardown] Run Keywords DELETE /album/${res.body.id}
... AND DELETE /album/${res2.body.id}
Find multiples albums filtered by type
[Documentation] Create two albums and find them
&{res}= POST
... /album
... {"name": "Mama mia"}
Output
Integer response status 201
&{res2}= POST
... /album
... {"name": "kldngsd"}
Output
Integer response status 201
&{get}= GET /album?id=${res.body.id}
Output
Integer response status 200
Should Contain ${get.body.data} ${res.body}
Should Not Contain ${get.body.data} ${res2.body}
[Teardown] Run Keywords DELETE /album/${res.body.id}
... AND DELETE /album/${res2.body.id}
+113
View File
@@ -0,0 +1,113 @@
*** Settings ***
Documentation Tests of the /genre route.
... Ensures that the genre CRUD works corectly.
Resource ../rest.resource
*** Test Cases ***
Create a genre
[Documentation] Create a genre
&{res}= POST
... /genre
... {"name": "Mama mia"}
Output
Integer response status 201
[Teardown] DELETE /genre/${res.body.id}
Duplicate a genre
[Documentation] Duplicate a genre
&{res}= POST
... /genre
... {"name": "Mama mia"}
Output
Integer response status 201
&{res2}= POST
... /genre
... {"name": "Mama mia"}
Output
Integer response status 409
Should Be Equal ${res.body.id} ${res2.body.id}
[Teardown] DELETE /genre/${res.body.id}
Find a genre
[Documentation] Create a genre and find it
&{res}= POST
... /genre
... {"name": "Mama mia"}
Output
Integer response status 201
&{get}= GET /genre/${res.body.id}
Output
Integer response status 200
Should Be Equal ${res.body} ${get.body}
[Teardown] DELETE /genre/${res.body.id}
Find a genre non existant
[Documentation] Find non existant genre
&{get}= GET /genre/9999
Integer response status 404
Find multiples genres
[Documentation] Create two genres and find them
&{res}= POST
... /genre
... {"name": "Mama mia"}
Output
Integer response status 201
&{res2}= POST
... /genre
... {"name": "Toto"}
Output
Integer response status 201
&{get}= GET /genre
Output
Integer response status 200
Should Contain ${get.body.data} ${res.body}
Should Contain ${get.body.data} ${res2.body}
[Teardown] Run Keywords DELETE /genre/${res.body.id}
... AND DELETE /genre/${res2.body.id}
Find multiples genres filtered
[Documentation] Create two genres and find them
&{res}= POST
... /genre
... {"name": "Mamamia"}
Output
Integer response status 201
&{res2}= POST
... /genre
... {"name": "jkgnsg"}
Output
Integer response status 201
&{get}= GET /genre?name=Mamamia
Output
Integer response status 200
Should Contain ${get.body.data} ${res.body}
Should Not Contain ${get.body.data} ${res2.body}
[Teardown] Run Keywords DELETE /genre/${res.body.id}
... AND DELETE /genre/${res2.body.id}
Find multiples genres filtered by type
[Documentation] Create two genres and find them
&{res}= POST
... /genre
... {"name": "Mama mia"}
Output
Integer response status 201
&{res2}= POST
... /genre
... {"name": "kldngsd"}
Output
Integer response status 201
&{get}= GET /genre?id=${res.body.id}
Output
Integer response status 200
Should Contain ${get.body.data} ${res.body}
Should Not Contain ${get.body.data} ${res2.body}
[Teardown] Run Keywords DELETE /genre/${res.body.id}
... AND DELETE /genre/${res2.body.id}