Ditched PATCH
This commit is contained in:
@@ -96,17 +96,6 @@ namespace raven_integration
|
|||||||
checkPUTWorked.ObjectResponse["data"]["name"].Value<string>().Should().Be(w2.name.ToString());
|
checkPUTWorked.ObjectResponse["data"]["name"].Value<string>().Should().Be(w2.name.ToString());
|
||||||
uint concurrencyToken = PUTTestResponse.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
uint concurrencyToken = PUTTestResponse.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||||
|
|
||||||
//PATCH
|
|
||||||
var newName = Util.Uniquify("UPDATED VIA PATCH SECOND TEST WIDGET");
|
|
||||||
string patchJson = "[{\"value\": \"" + newName + "\",\"path\": \"/name\",\"op\": \"replace\"}]";
|
|
||||||
ApiResponse PATCHTestResponse = await Util.PatchAsync("Widget/" + w2Id.ToString() + "/" + concurrencyToken.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), patchJson);
|
|
||||||
Util.ValidateHTTPStatusCode(PATCHTestResponse, 200);
|
|
||||||
|
|
||||||
//check PATCH worked
|
|
||||||
ApiResponse checkPATCHWorked = await Util.GetAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
|
||||||
Util.ValidateNoErrorInResponse(checkPATCHWorked);
|
|
||||||
checkPATCHWorked.ObjectResponse["data"]["name"].Value<string>().Should().Be(newName);
|
|
||||||
|
|
||||||
//DELETE
|
//DELETE
|
||||||
ApiResponse DELETETestResponse = await Util.DeleteAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
ApiResponse DELETETestResponse = await Util.DeleteAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||||
Util.ValidateHTTPStatusCode(DELETETestResponse, 204);
|
Util.ValidateHTTPStatusCode(DELETETestResponse, 204);
|
||||||
@@ -212,41 +201,6 @@ namespace raven_integration
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
[Fact]
|
|
||||||
public async void PatchConcurrencyViolationShouldFail()
|
|
||||||
{
|
|
||||||
|
|
||||||
//CREATE
|
|
||||||
|
|
||||||
dynamic w2 = new JObject();
|
|
||||||
w2.name = Util.Uniquify("PatchConcurrencyViolationShouldFail");
|
|
||||||
w2.notes="blah";
|
|
||||||
w2.customFields = Util.WidgetRequiredCustomFieldsJsonString();
|
|
||||||
w2.dollarAmount = 2.22m;
|
|
||||||
w2.active = true;
|
|
||||||
w2.usertype = 1;
|
|
||||||
w2.customFields = Util.WidgetRequiredCustomFieldsJsonString();
|
|
||||||
|
|
||||||
ApiResponse r2 = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w2.ToString());
|
|
||||||
Util.ValidateDataReturnResponseOk(r2);
|
|
||||||
long w2Id = r2.ObjectResponse["data"]["id"].Value<long>();
|
|
||||||
uint OriginalConcurrencyToken = r2.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
|
||||||
|
|
||||||
|
|
||||||
//PATCH
|
|
||||||
var newName = Util.Uniquify("PutConcurrencyViolationShouldFail UPDATED VIA PATCH");
|
|
||||||
string patchJson = "[{\"value\": \"" + newName + "\",\"path\": \"/name\",\"op\": \"replace\"}]";
|
|
||||||
ApiResponse PATCHTestResponse = await Util.PatchAsync("Widget/" + w2Id.ToString() + "/" + (OriginalConcurrencyToken - 1).ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), patchJson);
|
|
||||||
Util.ValidateConcurrencyError(PATCHTestResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==================================================
|
//==================================================
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
Reference in New Issue
Block a user