From 719a94969543f61a54eb830a61c748550e498890 Mon Sep 17 00:00:00 2001 From: laserlemon Date: Mon, 11 Oct 2010 16:04:12 -0400 Subject: [PATCH] Test the combination of attributes, params and URL params into an array of signature params. --- test/simple_oauth_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/simple_oauth_test.rb b/test/simple_oauth_test.rb index 5b4ce38..22238a8 100644 --- a/test/simple_oauth_test.rb +++ b/test/simple_oauth_test.rb @@ -81,4 +81,18 @@ class SimpleOAuthTest < Test::Unit::TestCase header = SimpleOAuth::Header.new(:get, 'https://api.twitter.com/statuses/friendships.json?test=1&test=2', {}) assert_equal [['test', '1'], ['test', '2']], header.send(:url_params) end + + def test_signature_params + header = SimpleOAuth::Header.new(:get, 'https://api.twitter.com/statuses/friendships.json', {}) + header.stubs(:attributes).returns(:attribute => 'ATTRIBUTE') + header.stubs(:params).returns('param' => 'PARAM') + header.stubs(:url_params).returns([['url_param', '1'], ['url_param', '2']]) + + # Should combine OAuth header attributes, body parameters and URL + # parameters into an array of key value pairs. + signature_params = header.send(:signature_params) + assert_kind_of Array, signature_params + assert_equal [:attribute, 'param', 'url_param', 'url_param'], signature_params.map(&:first) + assert_equal ['ATTRIBUTE', 'PARAM', '1', '2'], signature_params.map(&:last) + end end