This commit is contained in:
@@ -55,6 +55,8 @@ namespace raven_integration
|
||||
ApiResponse r3 = await Util.GetAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("InventoryFull"));
|
||||
Util.ValidateDataReturnResponseOk(r3);
|
||||
r3.ObjectResponse["data"]["name"].Value<string>().Should().Be(w.name.ToString());
|
||||
w = r3.ObjectResponse["data"];
|
||||
|
||||
|
||||
EventLogResponse = await Util.GetAsync($"EventLog/ObjectLog?AyType=2&AyId={w2Id}", await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateHTTPStatusCode(EventLogResponse, 200);
|
||||
@@ -65,14 +67,13 @@ namespace raven_integration
|
||||
EventLogResponse.ObjectResponse["data"]["events"][0]["event"].Value<int>().Should().Be(2);//AyEvent 2 = retrieved
|
||||
EventLogResponse.ObjectResponse["data"]["events"][0]["textra"].Should().BeNullOrEmpty();
|
||||
|
||||
|
||||
//*** MODIFIED
|
||||
//PUT
|
||||
//update w2id
|
||||
w.name = Util.Uniquify("UPDATED VIA PUT EVENTLOG TEST WIDGET");
|
||||
w.UserId = 1;
|
||||
w.concurrency = r2.ObjectResponse["data"]["concurrency"].Value<uint>();
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("InventoryFull"), w.ToString());
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("Widget", await Util.GetTokenAsync("InventoryFull"), w.ToString());
|
||||
Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||
|
||||
//*** RETRIEVED
|
||||
|
||||
@@ -66,6 +66,7 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long WidgetId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
uint Concurrency = a.ObjectResponse["data"]["concurrency"].Value<uint>();
|
||||
w = a.ObjectResponse["data"];
|
||||
|
||||
//validate the repository LIST ROUTE of tags contains the ones above
|
||||
a = await Util.GetAsync($"TagList/List?query={TagNameStart}", await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
@@ -85,7 +86,7 @@ namespace raven_integration
|
||||
//update Widget and put to server
|
||||
w.concurrency = Concurrency;
|
||||
w.tags = UpdateTags;
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("Widget/" + WidgetId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||
Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||
|
||||
|
||||
|
||||
@@ -85,9 +85,9 @@ namespace raven_integration
|
||||
|
||||
//update w2id
|
||||
w2.name = Util.Uniquify("UPDATED VIA PUT SECOND TEST WIDGET");
|
||||
|
||||
w2.id = w2Id;
|
||||
w2.concurrency = r2.ObjectResponse["data"]["concurrency"].Value<uint>();
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), w2.ToString());
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w2.ToString());
|
||||
Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||
|
||||
//check PUT worked
|
||||
@@ -168,34 +168,29 @@ namespace raven_integration
|
||||
{
|
||||
|
||||
//CREATE
|
||||
|
||||
dynamic w2 = new JObject();
|
||||
w2.name = Util.Uniquify("PutConcurrencyViolationShouldFail");
|
||||
w2.dollarAmount = 2.22m;
|
||||
w2.active = true;
|
||||
w2.usertype = 1;
|
||||
|
||||
w2.notes="blah";
|
||||
w2.notes = "blah";
|
||||
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>();
|
||||
Util.ValidateDataReturnResponseOk(r2);
|
||||
uint OriginalConcurrencyToken = r2.ObjectResponse["data"]["concurrency"].Value<uint>();
|
||||
|
||||
w2 = r2.ObjectResponse["data"];
|
||||
|
||||
|
||||
//UPDATE
|
||||
//PUT
|
||||
|
||||
w2.name = Util.Uniquify("PutConcurrencyViolationShouldFail UPDATE VIA PUT ");
|
||||
|
||||
w2.name = Util.Uniquify("PutConcurrencyViolationShouldFail UPDATE VIA PUT ");
|
||||
w2.concurrency = OriginalConcurrencyToken - 1;//bad token
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), w2.ToString());
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w2.ToString());
|
||||
Util.ValidateConcurrencyError(PUTTestResponse);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
2
util.cs
2
util.cs
@@ -382,7 +382,7 @@ namespace raven_integration
|
||||
{
|
||||
((int)a.HttpResponse.StatusCode).Should().Be(409);
|
||||
a.ObjectResponse["error"].Should().NotBeNull("There should be an error on the api call");
|
||||
a.ObjectResponse["error"]["code"].Value<int>().Should().Be(2005);
|
||||
//a.ObjectResponse["error"]["code"].Value<int>().Should().Be(2005);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user