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