def test_request_token_rsa_sha1(self):
        rsa_key = RSA.importKey("""-----BEGIN PRIVATE KEY-----
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALRiMLAh9iimur8V
A7qVvdqxevEuUkW4K+2KdMXmnQbG9Aa7k7eBjK1S+0LYmVjPKlJGNXHDGuy5Fw/d
7rjVJ0BLB+ubPK8iA/Tw3hLQgXMRRGRXXCn8ikfuQfjUS1uZSatdLB81mydBETlJ
hI6GH4twrbDJCR2Bwy/XWXgqgGRzAgMBAAECgYBYWVtleUzavkbrPjy0T5FMou8H
X9u2AC2ry8vD/l7cqedtwMPp9k7TubgNFo+NGvKsl2ynyprOZR1xjQ7WgrgVB+mm
uScOM/5HVceFuGRDhYTCObE+y1kxRloNYXnx3ei1zbeYLPCHdhxRYW7T0qcynNmw
rn05/KO2RLjgQNalsQJBANeA3Q4Nugqy4QBUCEC09SqylT2K9FrrItqL2QKc9v0Z
zO2uwllCbg0dwpVuYPYXYvikNHHg+aCWF+VXsb9rpPsCQQDWR9TT4ORdzoj+Nccn
qkMsDmzt0EfNaAOwHOmVJ2RVBspPcxt5iN4HI7HNeG6U5YsFBb+/GZbgfBT3kpNG
WPTpAkBI+gFhjfJvRw38n3g/+UeAkwMI2TJQS4n8+hid0uus3/zOjDySH3XHCUno
cn1xOJAyZODBo47E+67R4jV1/gzbAkEAklJaspRPXP877NssM5nAZMU0/O/NGCZ+
3jPgDUno6WbJn5cqm8MqWhW1xGkImgRk+fkDBquiq4gPiT898jusgQJAd5Zrr6Q8
AO/0isr/3aa6O6NLQxISLKcPDk2NOccAfS/xOtfOz4sJYM3+Bs4Io9+dZGSDCA54
Lw03eHTNQghS0A==
-----END PRIVATE KEY-----""")
        self.consumer.secret = rsa_key.exportKey()
        self.consumer.save()

        param = {
                    'scope':'all',
                    'consumer_name':'new_client'
                }

        request_token_path = "%s?%s" % (INITIATE_ENDPOINT, urllib.urlencode(param))
        # Header params we're passing in
        oauth_header_request_token_params = "OAuth realm=\"test\","\
               "oauth_consumer_key=\"%s\","\
               "oauth_signature_method=\"RSA-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 the params into a dict to pass into from_consumer_and_token
        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']

        # add scope to the existing params
        oauth_request = oauth.Request.from_consumer_and_token(self.consumer, token=None, http_method='GET',
            http_url=request_token_path, parameters=oauth_header_request_token_params_dict)
        
        # create signature and add it to the header params
        signature_method = SignatureMethod_RSA_SHA1()
        signature = signature_method.sign(oauth_request, self.consumer, None)
        oauth_header_request_token_params = oauth_header_request_token_params + ",oauth_signature=%s" % signature

        request_resp = self.client.get(request_token_path, Authorization=oauth_header_request_token_params)
        self.assertEqual(request_resp.status_code, 200)
        self.assertIn('oauth_token_secret', request_resp.content)
        self.assertIn('oauth_token', request_resp.content)
        self.assertIn('oauth_callback_confirmed', request_resp.content)
dataset/ETHPy150Open adlnet/ADL_LRS/lrs/tests/test_OAuth.py/OAuthTests.test_request_token_rsa_sha1/original