This commit is contained in:
@@ -31,7 +31,7 @@ namespace raven_integration
|
||||
D1.notes = "notes";
|
||||
D1.customFields = Util.UserRequiredCustomFieldsJsonString();
|
||||
|
||||
ApiResponse R1 = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D1.ToString());
|
||||
ApiResponse R1 = await Util.PostAsync("User", await Util.GetTokenAsync("superuser", "l3tm3in"), D1.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R1);
|
||||
long d1Id = R1.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace raven_integration
|
||||
|
||||
D2.userType = 3;//non scheduleable
|
||||
|
||||
ApiResponse R2 = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D2.ToString());
|
||||
ApiResponse R2 = await Util.PostAsync("User", await Util.GetTokenAsync("superuser", "l3tm3in"), D2.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R2);
|
||||
long d2Id = R2.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace raven_integration
|
||||
//RETRIEVE
|
||||
|
||||
//Get one
|
||||
ApiResponse R3 = await Util.GetAsync("User/" + d2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
ApiResponse R3 = await Util.GetAsync("User/" + d2Id.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateDataReturnResponseOk(R3);
|
||||
R3.ObjectResponse["data"]["name"].Value<string>().Should().Be(D2.name.ToString());
|
||||
|
||||
@@ -69,17 +69,17 @@ namespace raven_integration
|
||||
D2.name = Util.Uniquify("UPDATED VIA PUT SECOND TEST User");
|
||||
D2.concurrency = R2.ObjectResponse["data"]["concurrency"].Value<uint>();
|
||||
D2.id=d2Id;
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("User" , await Util.GetTokenAsync("manager", "l3tm3in"), D2.ToString());
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("User" , await Util.GetTokenAsync("superuser", "l3tm3in"), D2.ToString());
|
||||
Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||
|
||||
//check PUT worked
|
||||
ApiResponse checkPUTWorked = await Util.GetAsync("User/" + d2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
ApiResponse checkPUTWorked = await Util.GetAsync("User/" + d2Id.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateNoErrorInResponse(checkPUTWorked);
|
||||
checkPUTWorked.ObjectResponse["data"]["name"].Value<string>().Should().Be(D2.name.ToString());
|
||||
uint concurrency = PUTTestResponse.ObjectResponse["data"]["concurrency"].Value<uint>();
|
||||
|
||||
//DELETE
|
||||
ApiResponse DELETETestResponse = await Util.DeleteAsync("User/" + d2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
ApiResponse DELETETestResponse = await Util.DeleteAsync("User/" + d2Id.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateHTTPStatusCode(DELETETestResponse, 204);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace raven_integration
|
||||
[Fact]
|
||||
public async void UserWithActivityShouldNotBeDeleteable()
|
||||
{
|
||||
ApiResponse a = await Util.DeleteAsync("User/1", await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
ApiResponse a = await Util.DeleteAsync("User/1", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateErrorCodeResponse(a, 2200, 400);
|
||||
a.ObjectResponse["error"]["details"][0]["message"].Value<string>().Should().Contain("LT:ErrorDBForeignKeyViolation");
|
||||
}
|
||||
@@ -104,7 +104,7 @@ namespace raven_integration
|
||||
{
|
||||
//Get non existant
|
||||
//Should return status code 404, api error code 2010
|
||||
ApiResponse R = await Util.GetAsync("User/999999", await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
ApiResponse R = await Util.GetAsync("User/999999", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateResponseNotFound(R);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace raven_integration
|
||||
{
|
||||
//Get non existant
|
||||
//Should return status code 400, api error code 2200 and a first target in details of "id"
|
||||
ApiResponse R = await Util.GetAsync("User/2q2", await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
ApiResponse R = await Util.GetAsync("User/2q2", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateBadModelStateResponse(R, "id");
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace raven_integration
|
||||
|
||||
D.userType = 3;//non scheduleable
|
||||
|
||||
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("superuser", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long D1Id = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = R.ObjectResponse["data"]["concurrency"].Value<uint>();
|
||||
@@ -151,7 +151,7 @@ namespace raven_integration
|
||||
D.name = Util.Uniquify("PutConcurrencyViolationShouldFail UPDATE VIA PUT ");
|
||||
D.concurrency = OriginalConcurrencyToken - 1;//bad token
|
||||
D.id=D1Id;
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("User", await Util.GetTokenAsync("superuser", "l3tm3in"), D.ToString());
|
||||
Util.ValidateConcurrencyError(PUTTestResponse);
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace raven_integration
|
||||
d.notes = "notes";
|
||||
d.customFields = Util.UserRequiredCustomFieldsJsonString();
|
||||
|
||||
ApiResponse a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
ApiResponse a = await Util.PostAsync("User", await Util.GetTokenAsync("superuser", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long UserId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = a.ObjectResponse["data"]["concurrency"].Value<uint>();
|
||||
@@ -190,7 +190,7 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
//GET user (login changed concurrency token above)
|
||||
a = await Util.GetAsync("User/" + UserId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
a = await Util.GetAsync("User/" + UserId.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
d = a.ObjectResponse["data"];
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace raven_integration
|
||||
var NewPassword = "NEW_PASSWORD";
|
||||
d.password = NewPassword;
|
||||
d.login=DCreds.login;
|
||||
a = await Util.PutAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
a = await Util.PutAsync("User", await Util.GetTokenAsync("superuser", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
//Test can login with new creds
|
||||
@@ -229,7 +229,7 @@ namespace raven_integration
|
||||
d.roles = 0;//norole
|
||||
d.userType = 3;//non scheduleable
|
||||
|
||||
ApiResponse a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
ApiResponse a = await Util.PostAsync("User", await Util.GetTokenAsync("superuser", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ namespace raven_integration
|
||||
d.roles = 0;//norole
|
||||
d.userType = 3;//non scheduleable
|
||||
|
||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("superuser", "l3tm3in"), d.ToString());
|
||||
|
||||
Util.ValidateErrorCodeResponse(a, 2200, 400);
|
||||
Util.ShouldContainValidationError(a, "Login", "2206");
|
||||
|
||||
@@ -28,14 +28,14 @@ namespace raven_integration
|
||||
D1.notes = "notes";
|
||||
D1.customFields = Util.UserRequiredCustomFieldsJsonString();
|
||||
|
||||
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D1.ToString());
|
||||
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("superuser", "l3tm3in"), D1.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long UserId = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//Now there should be a user options available for this user
|
||||
|
||||
//RETRIEVE companion USEROPTIONS object
|
||||
R = await Util.GetAsync("user-option/" + UserId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
R = await Util.GetAsync("user-option/" + UserId.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
//ensure the default value is set
|
||||
R.ObjectResponse["data"]["uiColor"].Value<string>().Should().Be("#000000");
|
||||
@@ -53,11 +53,11 @@ namespace raven_integration
|
||||
D2.hour12 = false;
|
||||
D2.uiColor = "#ffaaff";
|
||||
D2.concurrency = concurrency;
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("user-option/" + UserId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), D2.ToString());
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("user-option/" + UserId.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"), D2.ToString());
|
||||
Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||
|
||||
//VALIDATE
|
||||
R = await Util.GetAsync("user-option/" + UserId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
R = await Util.GetAsync("user-option/" + UserId.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
//ensure the default value is set
|
||||
/*
|
||||
@@ -74,11 +74,11 @@ namespace raven_integration
|
||||
|
||||
|
||||
//DELETE USER
|
||||
ApiResponse DELETETestResponse = await Util.DeleteAsync("User/" + UserId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
ApiResponse DELETETestResponse = await Util.DeleteAsync("User/" + UserId.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateHTTPStatusCode(DELETETestResponse, 204);
|
||||
|
||||
//CHECK DELETE USER REMOVED USEROPTIONS
|
||||
R = await Util.GetAsync("user-option/" + UserId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
R = await Util.GetAsync("user-option/" + UserId.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateResponseNotFound(R);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace raven_integration
|
||||
{
|
||||
//Get non existant
|
||||
//Should return status code 404, api error code 2010
|
||||
ApiResponse R = await Util.GetAsync("user-option/999999", await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
ApiResponse R = await Util.GetAsync("user-option/999999", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateResponseNotFound(R);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace raven_integration
|
||||
{
|
||||
//Get non existant
|
||||
//Should return status code 400, api error code 2200 and a first target in details of "id"
|
||||
ApiResponse R = await Util.GetAsync("user-option/2q2", await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
ApiResponse R = await Util.GetAsync("user-option/2q2", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateBadModelStateResponse(R, "id");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user