4648
This commit is contained in:
@@ -34,11 +34,11 @@ namespace raven_integration
|
||||
w.usertype = 1;
|
||||
|
||||
//*** CREATED
|
||||
ApiResponse r2 = await Util.PostAsync("widget", await Util.GetTokenAsync("InventoryFull"), w.ToString());
|
||||
ApiResponse r2 = await Util.PostAsync("widget", await Util.GetTokenAsync("Inventory"), w.ToString());
|
||||
Util.ValidateDataReturnResponseOk(r2);
|
||||
long w2Id = r2.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
ApiResponse EventLogResponse = await Util.GetAsync($"event-log/objectlog?AyaType=2&AyId={w2Id}", await Util.GetTokenAsync("BizAdminFull"));
|
||||
ApiResponse EventLogResponse = await Util.GetAsync($"event-log/objectlog?AyaType=2&AyId={w2Id}", await Util.GetTokenAsync("BizAdmin"));
|
||||
Util.ValidateHTTPStatusCode(EventLogResponse, 200);
|
||||
|
||||
((JArray)EventLogResponse.ObjectResponse["data"]["events"]).Count.Should().Be(1);//only one event so far
|
||||
@@ -52,13 +52,13 @@ namespace raven_integration
|
||||
|
||||
//*** RETRIEVED
|
||||
//Get one
|
||||
ApiResponse r3 = await Util.GetAsync("widget/" + w2Id.ToString(), await Util.GetTokenAsync("InventoryFull"));
|
||||
ApiResponse r3 = await Util.GetAsync("widget/" + w2Id.ToString(), await Util.GetTokenAsync("Inventory"));
|
||||
Util.ValidateDataReturnResponseOk(r3);
|
||||
r3.ObjectResponse["data"]["name"].Value<string>().Should().Be(w.name.ToString());
|
||||
w = r3.ObjectResponse["data"];
|
||||
|
||||
|
||||
EventLogResponse = await Util.GetAsync($"event-log/objectlog?AyaType=2&AyId={w2Id}", await Util.GetTokenAsync("BizAdminFull"));
|
||||
EventLogResponse = await Util.GetAsync($"event-log/objectlog?AyaType=2&AyId={w2Id}", await Util.GetTokenAsync("BizAdmin"));
|
||||
Util.ValidateHTTPStatusCode(EventLogResponse, 200);
|
||||
//confirm event count, type and sort order (descending by date most recent first)
|
||||
((JArray)EventLogResponse.ObjectResponse["data"]["events"]).Count.Should().Be(2);
|
||||
@@ -73,17 +73,17 @@ namespace raven_integration
|
||||
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", await Util.GetTokenAsync("InventoryFull"), w.ToString());
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("widget", await Util.GetTokenAsync("Inventory"), w.ToString());
|
||||
Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||
|
||||
//*** RETRIEVED
|
||||
//check PUT worked
|
||||
ApiResponse checkPUTWorked = await Util.GetAsync("widget/" + w2Id.ToString(), await Util.GetTokenAsync("InventoryFull"));
|
||||
ApiResponse checkPUTWorked = await Util.GetAsync("widget/" + w2Id.ToString(), await Util.GetTokenAsync("Inventory"));
|
||||
Util.ValidateNoErrorInResponse(checkPUTWorked);
|
||||
checkPUTWorked.ObjectResponse["data"]["name"].Value<string>().Should().Be(w.name.ToString());
|
||||
uint concurrency = PUTTestResponse.ObjectResponse["data"]["concurrency"].Value<uint>();
|
||||
|
||||
EventLogResponse = await Util.GetAsync($"event-log/objectlog?AyaType=2&AyId={w2Id}", await Util.GetTokenAsync("BizAdminFull"));
|
||||
EventLogResponse = await Util.GetAsync($"event-log/objectlog?AyaType=2&AyId={w2Id}", await Util.GetTokenAsync("BizAdmin"));
|
||||
Util.ValidateHTTPStatusCode(EventLogResponse, 200);
|
||||
((JArray)EventLogResponse.ObjectResponse["data"]["events"]).Count.Should().Be(4);
|
||||
//put op is the second item in the list, top item is the recent fetch
|
||||
@@ -94,18 +94,18 @@ namespace raven_integration
|
||||
|
||||
|
||||
//Check user log for basic accessibility userlog?UserId=7
|
||||
EventLogResponse = await Util.GetAsync($"event-log/userlog?UserId={CurrentUserId}", await Util.GetTokenAsync("BizAdminFull"));
|
||||
EventLogResponse = await Util.GetAsync($"event-log/userlog?UserId={CurrentUserId}", await Util.GetTokenAsync("BizAdmin"));
|
||||
Util.ValidateHTTPStatusCode(EventLogResponse, 200);
|
||||
((JArray)EventLogResponse.ObjectResponse["data"]["events"]).Count.Should().BeGreaterOrEqualTo(4);//just one run of the above will be 4 events plus any others from other tests
|
||||
//Not sure of any easy way to assert the User log is correct other than the count as other tests running concurrently could easily skew this
|
||||
|
||||
|
||||
//DELETE
|
||||
ApiResponse DELETETestResponse = await Util.DeleteAsync("widget/" + w2Id.ToString(), await Util.GetTokenAsync("InventoryFull"));
|
||||
ApiResponse DELETETestResponse = await Util.DeleteAsync("widget/" + w2Id.ToString(), await Util.GetTokenAsync("Inventory"));
|
||||
Util.ValidateHTTPStatusCode(DELETETestResponse, 204);
|
||||
|
||||
//All events should be cleared up on deletion with the sole exception of the deleted event
|
||||
EventLogResponse = await Util.GetAsync($"event-log/objectlog?AyaType=2&AyId={w2Id}", await Util.GetTokenAsync("BizAdminFull"));
|
||||
EventLogResponse = await Util.GetAsync($"event-log/objectlog?AyaType=2&AyId={w2Id}", await Util.GetTokenAsync("BizAdmin"));
|
||||
Util.ValidateHTTPStatusCode(EventLogResponse, 200);
|
||||
((JArray)EventLogResponse.ObjectResponse["data"]["events"]).Count.Should().Be(1);
|
||||
EventLogResponse.ObjectResponse["data"]["events"][0]["date"].Value<DateTime>().Should().BeLessThan(new TimeSpan(1, 0, 0)).Before(DateTime.UtcNow);//should be less than one hour before now
|
||||
@@ -123,7 +123,7 @@ namespace raven_integration
|
||||
public async Task UserLogWorks()
|
||||
{
|
||||
//get admin log, sb lots of shit
|
||||
ApiResponse a = await Util.GetAsync($"event-log/userlog?UserId=1&Offset=0&Limit=999", await Util.GetTokenAsync("BizAdminFull"));
|
||||
ApiResponse a = await Util.GetAsync($"event-log/userlog?UserId=1&Offset=0&Limit=999", await Util.GetTokenAsync("BizAdmin"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
((JArray)a.ObjectResponse["data"]["events"]).Count.Should().BeGreaterThan(90);
|
||||
}
|
||||
@@ -145,7 +145,7 @@ namespace raven_integration
|
||||
d.active = true;
|
||||
d.login = UniqueName;
|
||||
d.password = UniqueName;
|
||||
d.roles = 2;//bizadminfull needs widget rights
|
||||
d.roles = 2;//BizAdmin needs widget rights
|
||||
d.userType = 3;//non scheduleable
|
||||
|
||||
//Required by form custom rules
|
||||
@@ -171,7 +171,7 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
}
|
||||
|
||||
a = await Util.GetAsync($"event-log/userlog?UserId={UserId}&Offset=0&Limit=9", await Util.GetTokenAsync("BizAdminFull"));
|
||||
a = await Util.GetAsync($"event-log/userlog?UserId={UserId}&Offset=0&Limit=9", await Util.GetTokenAsync("BizAdmin"));
|
||||
((JArray)a.ObjectResponse["data"]["events"]).Count.Should().Be(9);
|
||||
//capture events, then compare to paged ones
|
||||
var eventList = ((JArray)a.ObjectResponse["data"]["events"]);
|
||||
@@ -183,7 +183,7 @@ namespace raven_integration
|
||||
);
|
||||
}
|
||||
|
||||
a = await Util.GetAsync($"event-log/userlog?UserId={UserId}&Offset=0&Limit=3", await Util.GetTokenAsync("BizAdminFull"));
|
||||
a = await Util.GetAsync($"event-log/userlog?UserId={UserId}&Offset=0&Limit=3", await Util.GetTokenAsync("BizAdmin"));
|
||||
((JArray)a.ObjectResponse["data"]["events"]).Count.Should().Be(3);
|
||||
var pageEventList = ((JArray)a.ObjectResponse["data"]["events"]);
|
||||
foreach (JObject o in pageEventList)
|
||||
@@ -193,7 +193,7 @@ namespace raven_integration
|
||||
);
|
||||
}
|
||||
|
||||
a = await Util.GetAsync($"event-log/userlog?UserId={UserId}&Offset=1&Limit=3", await Util.GetTokenAsync("BizAdminFull"));
|
||||
a = await Util.GetAsync($"event-log/userlog?UserId={UserId}&Offset=1&Limit=3", await Util.GetTokenAsync("BizAdmin"));
|
||||
((JArray)a.ObjectResponse["data"]["events"]).Count.Should().Be(3);
|
||||
pageEventList = ((JArray)a.ObjectResponse["data"]["events"]);
|
||||
foreach (JObject o in pageEventList)
|
||||
@@ -204,7 +204,7 @@ namespace raven_integration
|
||||
}
|
||||
|
||||
|
||||
a = await Util.GetAsync($"event-log/userlog?UserId={UserId}&Offset=2&Limit=3", await Util.GetTokenAsync("BizAdminFull"));
|
||||
a = await Util.GetAsync($"event-log/userlog?UserId={UserId}&Offset=2&Limit=3", await Util.GetTokenAsync("BizAdmin"));
|
||||
((JArray)a.ObjectResponse["data"]["events"]).Count.Should().Be(3);
|
||||
pageEventList = ((JArray)a.ObjectResponse["data"]["events"]);
|
||||
foreach (JObject o in pageEventList)
|
||||
|
||||
Reference in New Issue
Block a user