def test_get_query_string(self):
     oauth_params = dict(
         oauth_blah=b("blah"),
     )
     headers = {
         "something": b("blah"),
     }
     params = dict(a=b("b"))
     expected = RequestAdapter(HTTP_GET,
                              FOO_URI + b("?a=b&oauth_blah=blah"),
                              None,
                              {"something": b("blah")})
     got = _OAuthClient._build_request(HTTP_GET,
                                       FOO_URI,
                                       params, None, headers,
                                       oauth_params, OAUTH_REALM, False)
     self.assertEqual(expected.method, got.method)
     self.assertEqual(expected.url, got.url)
     self.assertEqual(expected.body, got.body)
     self.assertDictEqual(expected.headers, got.headers)
 def test_payload(self):
     oauth_params = dict(
         oauth_blah=b("blah"),
     )
     headers = {
         "something": b("blah"),
     }
     params = dict(a=b("b"))
     expected = RequestAdapter(HTTP_POST,
                              FOO_URI,
                              b("a=b&oauth_blah=blah"),
                              {
         "something": b("blah"),
         HEADER_CONTENT_TYPE: CONTENT_TYPE_FORM_URLENCODED,
         HEADER_CONTENT_LENGTH: b("19"),
     })
     got = _OAuthClient._build_request(HTTP_POST,
                                       FOO_URI,
                                       params, b(""), headers,
                                       oauth_params, OAUTH_REALM, False)
     self.assertEqual(expected.method, got.method)
     self.assertEqual(expected.url, got.url)
     self.assertEqual(expected.body, got.body)
     self.assertDictEqual(expected.headers, got.headers)
 def test_auth_header(self):
     oauth_params = dict(
         oauth_blah=b("blah"),
     )
     headers = {
         "something": b("blah"),
     }
     params = dict(a=b("b"))
     expected = RequestAdapter(HTTP_GET,
                              FOO_URI + b("?a=b"),
                              None,
                              {
             HEADER_AUTHORIZATION_CAPS:
                 b('OAuth realm="realm",oauth_blah="blah"'),
             "something": b("blah"),
         })
     got = _OAuthClient._build_request(HTTP_GET,
                                       FOO_URI,
                                       params, None, headers,
                                       oauth_params, OAUTH_REALM, True)
     self.assertEqual(expected.method, got.method)
     self.assertEqual(expected.url, got.url)
     self.assertEqual(expected.body, got.body)
     self.assertDictEqual(expected.headers, got.headers)