Skip to content

Commit

Permalink
throw when get has body content (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzzerd committed Jun 6, 2023
1 parent 418b598 commit ce59967
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/FMData.Rest.Tests/GetByRecord.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public async Task GetByRecordId_ShouldReturnMatchingRecordId()
mockHttp.When(HttpMethod.Get, $"{server}/fmi/data/v1/databases/{file}/layouts/{layout}/records/{recordId}")
.Respond("application/json", DataApiResponses.SuccessfulGetById(recordId));

mockHttp.When(HttpMethod.Get, $"{server}/fmi/data/v1/databases/{file}/layouts/{layout}/records/{recordId}")
.WithPartialContent("{\"query\":[],\"limit\":\"100\",\"offset\":\"1\"}")
.Throw(new Exception("Cannot include content with GET."));

var fdc = new FileMakerRestClient(mockHttp.ToHttpClient(), new ConnectionInfo { FmsUri = server, Database = file, Username = user, Password = pass });

// act
Expand Down Expand Up @@ -69,6 +73,10 @@ public async Task GetByRecordId_ShouldHaveContainerWithContainerDataFor()
mockHttp.When(HttpMethod.Get, $"{server}/fmi/data/v1/databases/{file}/layouts/{layout}/records/{recordId}")
.Respond("application/json", DataApiResponses.SuccessfulGetByIdWithContainer(recordId, $"{server}/some-data-path"));

mockHttp.When(HttpMethod.Get, $"{server}/fmi/data/v1/databases/{file}/layouts/{layout}/records/{recordId}")
.WithPartialContent("{\"query\":[],\"limit\":\"100\",\"offset\":\"1\"}")
.Throw(new Exception("Cannot include content with GET."));

var fdc = new FileMakerRestClient(mockHttp.ToHttpClient(), new ConnectionInfo { FmsUri = server, Database = file, Username = user, Password = pass });

// act
Expand Down Expand Up @@ -98,6 +106,10 @@ public async Task GetByRecordId_Should_Throw_FMDataException_When_HTTP500()
mockHttp.When(HttpMethod.Get, $"{server}/fmi/data/v1/databases/{file}/layouts/{layout}/records/{recordId}")
.Respond(HttpStatusCode.InternalServerError, "application/json", DataApiResponses.LayoutNotFound());

mockHttp.When(HttpMethod.Get, $"{server}/fmi/data/v1/databases/{file}/layouts/{layout}/records/{recordId}")
.WithPartialContent("{\"query\":[],\"limit\":\"100\",\"offset\":\"1\"}")
.Throw(new Exception("Cannot include content with GET."));

var fdc = new FileMakerRestClient(
mockHttp.ToHttpClient(),
new ConnectionInfo
Expand Down

0 comments on commit ce59967

Please sign in to comment.