This commit is contained in:
@@ -190,6 +190,51 @@ namespace raven_integration
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void PatchPasswordShouldWork()
|
||||
{
|
||||
//CREATE
|
||||
dynamic D = new JObject();
|
||||
D.name = Util.Uniquify("PatchPasswordShouldWork");
|
||||
D.ownerId = 1L;
|
||||
D.active = true;
|
||||
D.login = Util.Uniquify("LOGIN");
|
||||
D.password = Util.Uniquify("PASSWORD");
|
||||
D.roles = 0;//norole
|
||||
D.localeId = 1;//random locale
|
||||
D.userType = 3;//non scheduleable
|
||||
|
||||
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long UserId = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
//Test can login
|
||||
dynamic DCreds = new JObject();
|
||||
DCreds.password = D.password;
|
||||
DCreds.login = D.login;
|
||||
R = await Util.PostAsync("Auth", null, DCreds.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
|
||||
|
||||
//PATCH
|
||||
var newPassword = "NEW_PASSWORD";
|
||||
string patchJson = "[{\"value\": \"" + newPassword + "\",\"path\": \"/password\",\"op\": \"replace\"}]";
|
||||
R = await Util.PatchAsync("User/" + UserId.ToString() + "/" + OriginalConcurrencyToken.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), patchJson);
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
|
||||
//Test can login with new creds
|
||||
//dynamic DCreds = new JObject();
|
||||
DCreds.password = newPassword;
|
||||
DCreds.login = D.login;
|
||||
R = await Util.PostAsync("Auth", null, DCreds.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ namespace raven_integration
|
||||
[Fact]
|
||||
public async void InactiveUserCantLogin()
|
||||
{
|
||||
dynamic creds = new JObject();
|
||||
creds.password = creds.login = "TEST_INACTIVE";
|
||||
ApiResponse a = await Util.PostAsync("Auth", null, creds.ToString());
|
||||
dynamic DCreds = new JObject();
|
||||
DCreds.password = DCreds.login = "TEST_INACTIVE";
|
||||
ApiResponse a = await Util.PostAsync("Auth", null, DCreds.ToString());
|
||||
Util.ValidateErrorCodeResponse(a,2004, 401);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user