def setUp(self): super(OAuthServerTest, self).setUp() self.signature_method = oauth.OAuthSignatureMethod_HMAC_SHA1() self.data_store = MockOAuthDataStore() self.user = MockUser('Foo Bar') self.request_token_url = "http://example.com/oauth/request_token" self.access_token_url = "http://example.com/oauth/access_token" self.oauth_server = oauth.OAuthServer(self.data_store, {self.signature_method.get_name(): self.signature_method})
def setUp(self): super(OAuthRequestTest, self).setUp() self.signature_method = oauth.OAuthSignatureMethod_HMAC_SHA1() self.non_oauth_param_message = 'message' self.non_oauth_param_context_id = 'context_id' self.parameters = { OAuthParameters.CONSUMER_KEY: self.consumer.key, OAuthParameters.TOKEN: self.token.key, OAuthParameters.SIGNATURE_METHOD: 'HMAC-SHA1', OAuthParameters.SIGNATURE: '947ysBZiMn6FGZ11AW06Ioco4mo=', OAuthParameters.TIMESTAMP: '1278573584', OAuthParameters.NONCE: '1770704051', OAuthParameters.VERSION: VERSION, self.non_oauth_param_message: 'hey', self.non_oauth_param_context_id: '', } oauth_params_string = """ oauth_nonce="1770704051", oauth_timestamp="1278573584", oauth_consumer_key="a56b5ff0a637ab283d1d8e32ced37a9c", oauth_signature_method="HMAC-SHA1", oauth_version="1.0", oauth_token="5b2cafbf20b11bace53b29e37d8a673d", oauth_signature="947ysBZiMn6FGZ11AW06Ioco4mo%3D" """ self.oauth_header_with_realm = { 'Authorization': """OAuth realm="http://example.com", %s """ % oauth_params_string } self.oauth_header_without_realm = { 'Authorization': 'OAuth %s' % oauth_params_string } self.additional_param = 'foo' self.additional_value = 'bar' self.oauth_request = oauth.OAuthRequest(self.http_method, self.http_url, self.parameters)