Logo Search packages:      
Sourcecode: ubuntuone-couch version File versions  Download package

def ubuntuone::tests::test_auth::QueryTestCase::test_get_oauth_request_header (   self )
Test get_oauth_request_header returns correct headers.

Definition at line 49 of file test_auth.py.

                                           :
        """Test get_oauth_request_header returns correct headers."""
        fake_headers = {'Authorization':
             'OAuth realm="", oauth_nonce="39941541", '
             'oauth_timestamp="1297958903", '
             'oauth_consumer_key="this_consumer_key", '
             'oauth_signature_method="HMAC-SHA1", oauth_version="1.0", '
             'oauth_token="tokentokentoken", '
             'oauth_signature="TNIfersCweWluuuJW%2FT%2FbW9IHD0%3D"'}
        mock_oauth = self.mocker.replace("oauth.oauth")
        mock_oauth.OAuthRequest                # pylint: disable=W0104
        MockOAuthRequest = self.mocker.mock()  # pylint: disable=C0103
        self.mocker.result(MockOAuthRequest)
        MockOAuthRequest.from_consumer_and_token(
            http_url=URL, http_method='GET', oauth_consumer=CONSUMER,
            token=TOKEN, parameters=None)
        oauth_request = self.mocker.mock()
        self.mocker.result(oauth_request)
        oauth_request.sign_request(HMAC_SHA1, CONSUMER, TOKEN)
        oauth_request.to_header()
        self.mocker.result(fake_headers)
        self.mocker.replay()
        headers = get_oauth_request_header(CONSUMER, TOKEN, URL)
        self.assertEquals(fake_headers, headers)


Generated by  Doxygen 1.6.0   Back to index