mirror of
https://github.com/samsonjs/simple_oauth.git
synced 2026-03-25 08:45:54 +00:00
Add URL encoding tests.
This commit is contained in:
parent
e1ecd99f42
commit
3286cffaa3
1 changed files with 14 additions and 0 deletions
|
|
@ -50,4 +50,18 @@ class SimpleOAuthTest < Test::Unit::TestCase
|
|||
assert_equal attribute_options.size, attributes.size
|
||||
assert attributes.all?{|k,v| k.to_s == "oauth_#{v.downcase}" }
|
||||
end
|
||||
|
||||
def test_encode
|
||||
# Non-word characters should be URL encoded...
|
||||
[' ', '!', '@', '$', '%', '^', '&'].each do |character|
|
||||
encoded = SimpleOAuth::Header.encode(character)
|
||||
assert_not_equal character, encoded
|
||||
assert_equal URI.encode(character, /.*/), encoded
|
||||
end
|
||||
|
||||
# ...except for the "-", "." and "~" characters.
|
||||
['-', '.', '~'].each do |character|
|
||||
assert_equal character, SimpleOAuth::Header.encode(character)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue