This commit is contained in:
2026-02-26 08:10:14 -08:00
parent ff69ab6381
commit 9600fc3742

View File

@@ -39,7 +39,7 @@ namespace raven_integration
ApiResponse a = await Util.PostAsync("project", await Util.GetTokenAsync("superuser", "l3tm3in"), payload); ApiResponse a = await Util.PostAsync("project", await Util.GetTokenAsync("superuser", "l3tm3in"), payload);
Util.ValidateDataReturnResponseOk(a); Util.ValidateDataReturnResponseOk(a);
long FirstObjectId = a.ObjectResponse["data"]["id"].Value<long>(); long FirstObjectId = a.ObjectResponse["data"]["id"].Value<long>();
((long)a.ObjectResponse["data"]["serial"]).Should().NotBe(0); ((string)a.ObjectResponse["data"]["name"]).Should().Be(projectName);
//another //another
projectName = Util.Uniquify("Second Test PROJECT"); projectName = Util.Uniquify("Second Test PROJECT");
payload = $$""" payload = $$"""
@@ -52,20 +52,21 @@ namespace raven_integration
//RETRIEVE //RETRIEVE
a = await Util.GetAsync("project/" + SecondObjectId.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in")); a = await Util.GetAsync("project/" + SecondObjectId.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
Util.ValidateDataReturnResponseOk(a); Util.ValidateDataReturnResponseOk(a);
a.ObjectResponse["data"]["name"].Value<string>().Should().Be("Second Test PROJECT"); a.ObjectResponse["data"]["name"].Value<string>().Should().Be(projectName);
a.ObjectResponse["data"]["notes"].Value<string>().Should().Be("What's the frequency Kenneth?"); a.ObjectResponse["data"]["notes"].Value<string>().Should().Be("What's the frequency Kenneth?");
((JArray)a.ObjectResponse["data"]["tags"]).Count.Should().Be(7); ((JArray)a.ObjectResponse["data"]["tags"]).Count.Should().Be(7);
//UPDATE //UPDATE
var oUpdate = a.ObjectResponse["data"]; var oUpdate = a.ObjectResponse["data"];
oUpdate["name"] = Util.Uniquify("UPDATED VIA PUT SECOND TEST WIDGET"); projectName = Util.Uniquify("UPDATED VIA PUT SECOND TEST WIDGET");
oUpdate["name"] = projectName;
a = await Util.PutAsync("project", await Util.GetTokenAsync("superuser", "l3tm3in"), oUpdate.ToString()); a = await Util.PutAsync("project", await Util.GetTokenAsync("superuser", "l3tm3in"), oUpdate.ToString());
Util.ValidateHTTPStatusCode(a, 200); Util.ValidateHTTPStatusCode(a, 200);
//check PUT worked //check PUT worked
a = await Util.GetAsync("project/" + SecondObjectId.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in")); a = await Util.GetAsync("project/" + SecondObjectId.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
Util.ValidateNoErrorInResponse(a); Util.ValidateNoErrorInResponse(a);
a.ObjectResponse["data"]["name"].Value<string>().Should().Be("UPDATED VIA PUT SECOND TEST WIDGET"); a.ObjectResponse["data"]["name"].Value<string>().Should().Be(projectName);
//DELETE //DELETE
a = await Util.DeleteAsync("project/" + FirstObjectId.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in")); a = await Util.DeleteAsync("project/" + FirstObjectId.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
@@ -143,7 +144,7 @@ namespace raven_integration
w2.active = true; w2.active = true;
w2.usertype = 1; w2.usertype = 1;
w2.notes = "blah"; w2.notes = "blah";
ApiResponse r2 = await Util.PostAsync("project", await Util.GetTokenAsync("superuser", "l3tm3in"), w2.ToString()); ApiResponse r2 = await Util.PostAsync("project", await Util.GetTokenAsync("superuser", "l3tm3in"), w2.ToString());