Skip to content

Commit

Permalink
#18: Synergy.Web.Api.Testing: Added sample how to ingnore request hea…
Browse files Browse the repository at this point in the history
…der when comparing HTTP operation with its saved pattern.
  • Loading branch information
MarcinCelej committed May 16, 2024
1 parent a61146e commit a41a16a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"description": "Get list of users",
"method": "GET /api/v1/users",
"headers": {
"test": "header"
"test": "header1"
}
},
"response": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ private void GetEmptyListOfUsers()
.ShouldBe(ApiConventionFor.GetListOfResources())
.ShouldBe(
this.EqualToPattern("/Patterns/S01_E01_GetEmptyListOfUsers.json")
.Ignore(Ignore.RequestHeaders("test"))
.Expected("Manual: Empty users list is returned")
);
}
Expand Down
23 changes: 10 additions & 13 deletions Web/Sample/Synergy.Sample.Web.API.Tests/Users/Users.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
- Request
```
GET /api/v1/users
test: header
test: header1
```

- Response
Expand Down Expand Up @@ -57,9 +57,8 @@ Content-Length: 19
- Request
```
POST /api/v1/users
Content-Type: application/json; charset=utf-8
Content-Length: 40
test: header
Content-Type: application/json; charset=utf-8
{
"Login": {
"Value": "[email protected]"
Expand All @@ -70,16 +69,17 @@ test: header
- Response
```
HTTP/1.1 201 Created
Location: http://localhost/api/v1/users/102a023150d94b1b99dbfbd5d6a695d8
Location: http://localhost/api/v1/users/0dd576b44c7a40a4884cc7512272e751
api-supported-versions: 1.0
Content-Type: application/json; charset=utf-8
Content-Length: 129
Content-Length: 182
{
"user": {
"id": "102a023150d94b1b99dbfbd5d6a695d8",
"id": "0dd576b44c7a40a4884cc7512272e751",
"login": {
"value": "[email protected]"
}
},
"created": "2024-05-13T13:19:15.8420304+02:00"
}
}
```
Expand Down Expand Up @@ -262,9 +262,8 @@ Content-Length: 207
- Request
```
POST /api/v1/users
Content-Type: application/json; charset=utf-8
Content-Length: 14
test: header
Content-Type: application/json; charset=utf-8
{
"login": null
}
Expand Down Expand Up @@ -305,9 +304,8 @@ Content-Length: 351
- Request
```
POST /api/v1/users
Content-Type: application/json; charset=utf-8
Content-Length: 12
test: header
Content-Type: application/json; charset=utf-8
{
"login": ""
}
Expand Down Expand Up @@ -348,9 +346,8 @@ Content-Length: 349
- Request
```
POST /api/v1/users
Content-Type: application/json; charset=utf-8
Content-Length: 14
test: header
Content-Type: application/json; charset=utf-8
{
"login": " "
}
Expand Down

0 comments on commit a41a16a

Please sign in to comment.