diff --git a/test/raven-integration/User/UserCrud.cs b/test/raven-integration/User/UserCrud.cs index 7556e4cc..76ae2ee7 100644 --- a/test/raven-integration/User/UserCrud.cs +++ b/test/raven-integration/User/UserCrud.cs @@ -190,6 +190,51 @@ namespace raven_integration } + /// + /// + /// + [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(); + uint OriginalConcurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value(); + + //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); + } + + diff --git a/test/raven-integration/User/UserInactive.cs b/test/raven-integration/User/UserInactive.cs index 3cf4976c..64b99fe8 100644 --- a/test/raven-integration/User/UserInactive.cs +++ b/test/raven-integration/User/UserInactive.cs @@ -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); }