test/url_test.rb in hurley-0.1 vs test/url_test.rb in hurley-0.2

- old
+ new

@@ -395,17 +395,25 @@ def test_basic_auth_user_with_password u = Url.parse("http://a%20b:1%20%2B%202@foo.com") assert_equal "a b", u.user assert_equal "1 + 2", u.password - assert_equal "Basic #{Base64.encode64("a b:1 + 2").rstrip}", u.basic_auth + assert_equal "Basic YSBiOjEgKyAy", u.basic_auth end + def test_basic_auth_user_with_non_encoded_password + u = Url.parse("http://a%20b:MxYut8Rj8tQi6%3DwNf.miTxf%3Eq49%3F%2Cf%40v" \ + "QX8og3YT%3Fs.%5D8L3h9)@foo.com") + assert_equal "a b", u.user + assert_equal "MxYut8Rj8tQi6=wNf.miTxf>q49?,f@vQX8og3YT?s.]8L3h9)", u.password + assert_equal "Basic YSBiOk14WXV0OFJqOHRRaTY9d05mLm1pVHhmPnE0OT8sZkB2UVg4b2czWVQ/cy5dOEwzaDkp", u.basic_auth + end + def test_basic_auth_user_without_password u = Url.parse("http://a%20b@foo.com") assert_equal "a b", u.user assert_nil u.password - assert_equal "Basic #{Base64.encode64("a b").rstrip}", u.basic_auth + assert_equal "Basic YSBi", u.basic_auth end def test_join_url_with_auth_url u = Url.join("http://c.com/path", "http://a:b@c.com") assert_equal "a", u.user