public void TestInvalidContentTypeForcePasswordChange() { var handler = new ForcePasswordChangeManager(); var response = handler.ForcePasswordChange <object>(new Dictionary <string, object>(), System.Net.Http.HttpMethod.Post, "application/text"); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(HttpStatusCode.UnsupportedMediaType), $"Request force password change api with content type = application/text successfully."); }
public void TestForcePasswordChangeByOtherMethod(HttpMethod httpMethod) { var handler = new ForcePasswordChangeManager(); var response = handler.ForcePasswordChange <object>(new Dictionary <string, object>(), HttpMethodMapper[httpMethod]); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(HttpStatusCode.MethodNotAllowed), $"Still able to request force password change api with {httpMethod} method."); }
public void TestInvalidHeaderForcePasswordChange(InvalidUserId invalidUserId) { var request = new Dictionary <string, object>(); InvalidUserIdMapper[invalidUserId](request); var handler = new ForcePasswordChangeManager(); var response = handler.ForcePasswordChangeDiffHeader <object>(request, System.Net.Http.HttpMethod.Post); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(HttpStatusCode.BadRequest), $"Request force password change api with header {invalidUserId} successfully."); }
public void TestInvalidHeaderOtherParamForcePasswordChange(string paramName, string value) { var request = new Dictionary <string, object>() { [paramName] = value, }; var handler = new ForcePasswordChangeManager(); var response = handler.ForcePasswordChangeDiffHeader <object>(request, System.Net.Http.HttpMethod.Post); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(HttpStatusCode.BadRequest), $"Request force password change api with header {paramName} = {value} successfully."); }
public void TestValidForcePasswordChange(UserType userType) { var header = new Dictionary <string, object>() { ["userId"] = TestContext.CurrentContext.Test.Properties.Get("adminUser2Login").ToString(), }; var handler = new ForcePasswordChangeManager(); var response = handler.ForcePasswordChangeDiffHeaderWithContent <object>(header, new Dictionary <string, object>(), System.Net.Http.HttpMethod.Post); PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(HttpStatusCode.NoContent), $"Not able to request force password change api with {userType}."); }
public void TestInvalidBodyForcePasswordChange(InvalidUserId invalidUserId) { var request = new Dictionary <string, object>(); InvalidUserIdMapper[invalidUserId](request); var header = new Dictionary <string, object>() { ["userId"] = TestContext.CurrentContext.Test.Properties.Get("adminUser2Login").ToString(), }; var handler = new ForcePasswordChangeManager(); var response = handler.ForcePasswordChangeDiffHeaderWithContent <object>(header, request, System.Net.Http.HttpMethod.Post); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(HttpStatusCode.BadRequest), $"request force password change api with body {invalidUserId} successfully."); }