Example #1
0
        public void Getting_user_info_parts_When_nothing_is_provided_It_returns_empty_array()
        {
            var r = new Uri("http://localhost:5984").GetUserInfoParts();

            r.Should().NotBeNull();
            r.Should().BeEmpty();
        }
 private static void AssertShouldBeCachedReferenceTo(Uri query, Uri expected)
 {
     query.Should().Be(expected);
     TestData.HaveCachedResponseFor(query).Should().BeTrue();
 }
 public void should_have_correct_target_uri()
 {
     CloudActive.Target(TestAccountInformation.GoodUri.ToString());
     var designatedUri = new Uri(CloudActive.CurrentUri);
     designatedUri.Should().Be(TestAccountInformation.GoodUri.ToString());
 }
        public void ShouldRedirectToFailurePathIfErrorIn()
        {
            // See https://tools.ietf.org/html/rfc6749#section-4.1.2.1
            using (TestAppHost())
            {
                Subject.ClientId = "c1";
                Subject.FailureRedirectPath = "/auth-failure";
                var request = new MockHttpRequest("auth", "GET", "text", "/auth/foo?error=invalid_request", new NameValueCollection {{"error", "invalid_request"}}, Stream.Null, null);
                var mockAuthService = MockAuthService(request);

                var response = Subject.Authenticate(mockAuthService.Object, new AuthUserSession(), new Authenticate());

                var result = (IHttpResult)response;
                var redirectRequest = new Uri(result.Headers["Location"]);
                redirectRequest.Should().Be("http://localhost/auth-failure");
                //var query = PclExportClient.Instance.ParseQueryString(redirectRequest.Query);
                //query["response_type"].Should().Be("code");
            }
        }
Example #5
0
        public void Getting_basic_auth_string_When_nothing_is_provided_It_returns_null()
        {
            var r = new Uri("http://localhost:5984").GetBasicAuthString();

            r.Should().BeNull();
        }
Example #6
0
        public void Getting_user_info_parts_When_non_encoded_user_and_password_are_provided_It_extracts_user_and_password()
        {
            var r = new Uri("http://tstUser:[email protected]:5984").GetUserInfoParts();

            r.Should().BeEquivalentTo("tstUser", "tstPwd");
        }
Example #7
0
        public void Getting_user_info_parts_When_encoded_user_and_password_are_provided_It_extracts_decoded_user_and_password()
        {
            var r = new Uri("http://s%40:p%[email protected]:5984").GetUserInfoParts();

            r.Should().BeEquivalentTo("[email protected]", "[email protected]");
        }
Example #8
0
        public void Getting_absolute_uri_excluding_user_info_When_no_user_info_exists_It_should_return_uri()
        {
            var r = new Uri("http://localhost:5984/resource/1").GetAbsoluteUriExceptUserInfo();

            r.Should().Be("http://localhost:5984/resource/1");
        }