예제 #1
0
        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.");
        }
예제 #2
0
        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.");
        }
예제 #3
0
        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.");
        }
예제 #4
0
        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.");
        }
예제 #5
0
        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}.");
        }
예제 #6
0
        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.");
        }