def test_request_token_wrong_scope(self):
        # passing scope as form param instead of in query string in this instance
        form_data = {
            'scope':'all',
        }

        oauth_header_request_token_params = "OAuth realm=\"test\","\
               "oauth_consumer_key=\"%s\","\
               "oauth_signature_method=\"HMAC-SHA1\","\
               "oauth_timestamp=\"%s\","\
               "oauth_nonce=\"requestnonce\","\
               "oauth_version=\"1.0\","\
               "oauth_callback=\"http://example.com/request_token_ready\"" % (self.consumer.key,str(int(time.time())))

        # Make string params into dictionary for from_consumer_and_token function
        request_token_param_list = oauth_header_request_token_params.split(",")
        oauth_header_request_token_params_dict = {}
        for p in request_token_param_list:
            item = p.split("=")
            oauth_header_request_token_params_dict[str(item[0]).strip()] = str(item[1]).strip('"')

        # get_oauth_request in views ignores realm, must remove so not input to from_token_and_callback
        del oauth_header_request_token_params_dict['OAuth realm']

        oauth_request = oauth.Request.from_consumer_and_token(self.consumer, token=None, http_method='GET',
            http_url=INITIATE_ENDPOINT, parameters=dict(oauth_header_request_token_params_dict.items()+form_data.items()))
        signature_method = oauth.SignatureMethod_HMAC_SHA1()
        signature = signature_method.sign(oauth_request, self.consumer, None)

        # Add signature
        oauth_header_request_token_params = oauth_header_request_token_params + ",oauth_signature=%s" % signature
        
        #Change form scope from what oauth_request was made with
        form_data['scope'] = 'profile'

        request_resp = self.client.get(INITIATE_ENDPOINT, Authorization=oauth_header_request_token_params, data=form_data,
            content_type="x-www-form-urlencoded")
        self.assertEqual(request_resp.status_code, 400)
        self.assertEqual(request_resp.content, 'Could not verify OAuth request.')
dataset/ETHPy150Open adlnet/ADL_LRS/lrs/tests/test_OAuth.py/OAuthTests.test_request_token_wrong_scope/original