This commit is contained in:
@@ -22,6 +22,7 @@ Overall plan for now: anything standing in the way of making the initial client
|
|||||||
- Audit log
|
- Audit log
|
||||||
- Route for retrieving as log format for reading (like reports: one for specific object id and type, one for user id as log of what they've been doing etc)
|
- Route for retrieving as log format for reading (like reports: one for specific object id and type, one for user id as log of what they've been doing etc)
|
||||||
- Test with huge dataset
|
- Test with huge dataset
|
||||||
|
- Remove CREATED from all objects now that event log tracks it
|
||||||
- Localized text
|
- Localized text
|
||||||
- Search and search text indexing
|
- Search and search text indexing
|
||||||
- Auto visible id number assigning code
|
- Auto visible id number assigning code
|
||||||
|
|||||||
92
test/raven-integration/EventLog/EventLog.cs
Normal file
92
test/raven-integration/EventLog/EventLog.cs
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
using System;
|
||||||
|
using Xunit;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using FluentAssertions;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
|
||||||
|
namespace raven_integration
|
||||||
|
{
|
||||||
|
|
||||||
|
public class EventLog
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public async void ObjectLogWorks()
|
||||||
|
{
|
||||||
|
//CRUD a widget and confirm it logs properly
|
||||||
|
//http://localhost:7575/api/v8.0/EventLog/UserLog?AyType=3&AyId=1
|
||||||
|
//http://localhost:7575/api/v8.0/EventLog/ObjectLog?AyType=2&AyId=242
|
||||||
|
//http://localhost:7575/api/v8.0/EventLog/UserLog?AyType=3&AyId=1&StartDate=2018-08-23&EndDate=2018-08-24
|
||||||
|
|
||||||
|
dynamic w = new JObject();
|
||||||
|
w.name = Util.Uniquify("EventLog Test WIDGET");
|
||||||
|
w.created = DateTime.Now.ToString();
|
||||||
|
w.dollarAmount = 2.22m;
|
||||||
|
w.active = true;
|
||||||
|
w.roles = 0;
|
||||||
|
|
||||||
|
ApiResponse r2 = await Util.PostAsync("Widget", await Util.GetTokenAsync("InventoryFull"), w.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(r2);
|
||||||
|
long w2Id = r2.ObjectResponse["result"]["id"].Value<long>();
|
||||||
|
|
||||||
|
|
||||||
|
//RETRIEVE
|
||||||
|
|
||||||
|
//Get one
|
||||||
|
ApiResponse r3 = await Util.GetAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("InventoryFull"));
|
||||||
|
Util.ValidateDataReturnResponseOk(r3);
|
||||||
|
r3.ObjectResponse["result"]["name"].Value<string>().Should().Be(w.name.ToString());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//UPDATE
|
||||||
|
//PUT
|
||||||
|
|
||||||
|
//update w2id
|
||||||
|
w.name = Util.Uniquify("UPDATED VIA PUT SECOND TEST WIDGET");
|
||||||
|
w.OwnerId = 1;
|
||||||
|
w.concurrencyToken = r2.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||||
|
ApiResponse PUTTestResponse = await Util.PutAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("InventoryFull"), w.ToString());
|
||||||
|
Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||||
|
|
||||||
|
//check PUT worked
|
||||||
|
ApiResponse checkPUTWorked = await Util.GetAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("InventoryFull"));
|
||||||
|
Util.ValidateNoErrorInResponse(checkPUTWorked);
|
||||||
|
checkPUTWorked.ObjectResponse["result"]["name"].Value<string>().Should().Be(w.name.ToString());
|
||||||
|
uint concurrencyToken = PUTTestResponse.ObjectResponse["result"]["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("InventoryFull"), patchJson);
|
||||||
|
Util.ValidateHTTPStatusCode(PATCHTestResponse, 200);
|
||||||
|
|
||||||
|
//check PATCH worked
|
||||||
|
ApiResponse checkPATCHWorked = await Util.GetAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("InventoryFull"));
|
||||||
|
Util.ValidateNoErrorInResponse(checkPATCHWorked);
|
||||||
|
checkPATCHWorked.ObjectResponse["result"]["name"].Value<string>().Should().Be(newName);
|
||||||
|
|
||||||
|
//DELETE
|
||||||
|
ApiResponse DELETETestResponse = await Util.DeleteAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("InventoryFull"));
|
||||||
|
Util.ValidateHTTPStatusCode(DELETETestResponse, 204);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ApiTextResponse t = await Util.GetTextResultAsync("EventLog/", await Util.GetTokenAsync("BizAdminFull"));
|
||||||
|
Util.ValidateHTTPStatusCode(t, 200);
|
||||||
|
t.TextResponse.Should().Contain("|INFO|");//assumes any log will have at least one INFO log item in it
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//==================================================
|
||||||
|
|
||||||
|
}//eoc
|
||||||
|
}//eons
|
||||||
Reference in New Issue
Block a user