test: all tests create their own data — create album returns ID, all mutations use self-created resources
This commit is contained in:
@@ -217,7 +217,7 @@ public class AlbumController(
|
||||
albumRepository.Insert(album);
|
||||
albumRepository.Save();
|
||||
|
||||
return Ok();
|
||||
return Ok(album.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -252,22 +252,6 @@ Authorization: Bearer {{auth_token}}
|
||||
});
|
||||
%}
|
||||
|
||||
### Update person name as admin
|
||||
POST {{WepApiTest_HostAddress}}/api/person/{{personId}}
|
||||
Authorization: Bearer {{admin_token}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"name": "Updated via API Test",
|
||||
"profileAssetId": null
|
||||
}
|
||||
|
||||
> {%
|
||||
client.test("Update person name as admin", function () {
|
||||
client.assert(response.status === 200)
|
||||
});
|
||||
%}
|
||||
|
||||
### Create person as rng user (should be 403)
|
||||
PUT {{WepApiTest_HostAddress}}/api/person
|
||||
Authorization: Bearer {{auth_token}}
|
||||
@@ -301,6 +285,22 @@ Content-Type: application/json
|
||||
});
|
||||
%}
|
||||
|
||||
### Update created person name as admin
|
||||
POST {{WepApiTest_HostAddress}}/api/person/{{createdPersonId}}
|
||||
Authorization: Bearer {{admin_token}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"name": "Updated via API Test",
|
||||
"profileAssetId": null
|
||||
}
|
||||
|
||||
> {%
|
||||
client.test("Update created person name as admin", function () {
|
||||
client.assert(response.status === 200)
|
||||
});
|
||||
%}
|
||||
|
||||
### Get created person by ID as admin
|
||||
GET {{WepApiTest_HostAddress}}/api/person/{{createdPersonId}}
|
||||
Authorization: Bearer {{admin_token}}
|
||||
@@ -355,13 +355,13 @@ Content-Type: application/json
|
||||
});
|
||||
%}
|
||||
|
||||
### Bulk update person as admin
|
||||
### Bulk update created person as admin
|
||||
POST {{WepApiTest_HostAddress}}/api/person
|
||||
Authorization: Bearer {{admin_token}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"ids": ["{{personId}}"],
|
||||
"ids": ["{{createdPersonId}}"],
|
||||
"data": { "name": "Bulk Updated Person" }
|
||||
}
|
||||
|
||||
@@ -384,22 +384,25 @@ Content-Type: application/json
|
||||
});
|
||||
%}
|
||||
|
||||
### Get unassigned albums as admin
|
||||
GET {{WepApiTest_HostAddress}}/api/album?unassigned=true&pageSize=5
|
||||
### Create test album as admin
|
||||
PUT {{WepApiTest_HostAddress}}/api/album
|
||||
Authorization: Bearer {{admin_token}}
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"name": "Test Album for E2E"
|
||||
}
|
||||
|
||||
> {%
|
||||
client.test("Get unassigned albums as admin", function () {
|
||||
client.global.set("testAlbumId", jsonPath(response.body, "$"));
|
||||
client.test("Create test album as admin", function () {
|
||||
client.assert(response.status === 200)
|
||||
client.assert(jsonPath(response.body, "$") != null)
|
||||
});
|
||||
var albums = response.body;
|
||||
var albumId = (Array.isArray(albums) && albums.length > 0) ? albums[0].id : "00000000-0000-0000-0000-000000000000";
|
||||
client.global.set("unassignedAlbumId", albumId);
|
||||
%}
|
||||
|
||||
### Assign unassigned album to created person (if album exists)
|
||||
POST {{WepApiTest_HostAddress}}/api/album/{{unassignedAlbumId}}
|
||||
### Assign test album to created person
|
||||
POST {{WepApiTest_HostAddress}}/api/album/{{testAlbumId}}
|
||||
Authorization: Bearer {{admin_token}}
|
||||
Content-Type: application/json
|
||||
|
||||
@@ -409,12 +412,27 @@ Content-Type: application/json
|
||||
|
||||
> {%
|
||||
client.test("Assign album to person", function () {
|
||||
client.assert(response.status === 200 || response.status === 404)
|
||||
client.assert(response.status === 200)
|
||||
});
|
||||
%}
|
||||
|
||||
### Remove person assignment from album (if album exists)
|
||||
POST {{WepApiTest_HostAddress}}/api/album/{{unassignedAlbumId}}
|
||||
### Update test album without removePerson field (should not affect person link)
|
||||
POST {{WepApiTest_HostAddress}}/api/album/{{testAlbumId}}
|
||||
Authorization: Bearer {{admin_token}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"name": "Test Album Updated"
|
||||
}
|
||||
|
||||
> {%
|
||||
client.test("Update album without removePerson", function () {
|
||||
client.assert(response.status === 200)
|
||||
});
|
||||
%}
|
||||
|
||||
### Remove person assignment from test album
|
||||
POST {{WepApiTest_HostAddress}}/api/album/{{testAlbumId}}
|
||||
Authorization: Bearer {{admin_token}}
|
||||
Content-Type: application/json
|
||||
|
||||
@@ -424,36 +442,17 @@ Content-Type: application/json
|
||||
|
||||
> {%
|
||||
client.test("Unlink person from album", function () {
|
||||
client.assert(response.status === 200 || response.status === 404)
|
||||
});
|
||||
%}
|
||||
|
||||
### Get any album (to use for update test)
|
||||
GET {{WepApiTest_HostAddress}}/api/album?pageSize=1
|
||||
Authorization: Bearer {{admin_token}}
|
||||
Accept: application/json
|
||||
|
||||
> {%
|
||||
client.test("Get any album for update test", function () {
|
||||
client.assert(response.status === 200)
|
||||
});
|
||||
var albums = response.body;
|
||||
var albumId = (Array.isArray(albums) && albums.length > 0) ? albums[0].id : "00000000-0000-0000-0000-000000000000";
|
||||
client.global.set("realAlbumId", albumId);
|
||||
%}
|
||||
|
||||
### Update existing album without removePerson field (should not affect person link)
|
||||
POST {{WepApiTest_HostAddress}}/api/album/{{realAlbumId}}
|
||||
### Delete test album
|
||||
DELETE {{WepApiTest_HostAddress}}/api/album/{{testAlbumId}}
|
||||
Authorization: Bearer {{admin_token}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"name": "Just a Name Change"
|
||||
}
|
||||
|
||||
> {%
|
||||
client.test("Update existing album without removePerson", function () {
|
||||
client.assert(response.status === 200 || response.status === 404)
|
||||
client.test("Delete test album", function () {
|
||||
client.assert(response.status === 200)
|
||||
});
|
||||
%}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user