def test_valid_base_string(self):
     base_string = generate_signature_base_string("POST",
                                                   "http://example.com/request?b5=%3D%253D&a3=a&c%40=&a2=r%20b&c2&a3=2+q"
                                                   ,
                                                   self.oauth_params)
     assert_equal(base_string,
                  "POST&http%3A%2F%2Fexample.com%2Frequest&a2%3Dr%2520b%26a3%3D2%2520q%26a3%3Da%26b5%3D%253D%25253D%26c%2540%3D%26c2%3D%26oauth_consumer_key%3D9djdj82h48djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39sjv7")
 def test_base_string_does_not_contain_oauth_signature(self):
     # Ensure both are present in the query params as well as the URL.
     oauth_params = {
         "realm": "example.com",
     }
     oauth_params.update(self.oauth_params)
     url = "http://example.com/request?oauth_signature=foobar&realm=something"
     base_string = generate_signature_base_string("POST", url, oauth_params)
     assert_true("oauth_signature%3D" not in base_string)
     assert_true("realm%3Dexample.com" not in base_string)
     assert_true("realm%3Dsomething" in base_string)
 def test_base_string_preserves_matrix_params_and_drops_default_ports(self):
     url = "http://social.yahooapis.com:80/v1/user/6677/connections;start=0;count=20?format=json#fragment"
     base_string = "POST&http://social.yahooapis.com/v1/user/6677/connections;start=0;count=20&format=json"
     assert_equal(percent_decode(generate_signature_base_string("POST", url, dict())), base_string)