'Attempt to log in through the open id provider login'

def attempt_login(self, expected_code, login_method='POST', **kwargs):

    url = reverse('openid-provider-login')
    args = {'openid.mode': 'checkid_setup', 'openid.return_to': 'http://testserver/openid/complete/?janrain_nonce=2013-01-23T06%3A20%3A17ZaN7j6H', 'openid.assoc_handle': '{HMAC-SHA1}{50ff8120}{rh87+Q==}', 'openid.claimed_id': 'http://specs.openid.net/auth/2.0/identifier_select', 'openid.ns': 'http://specs.openid.net/auth/2.0', 'openid.realm': 'http://testserver/', 'openid.identity': 'http://specs.openid.net/auth/2.0/identifier_select', 'openid.ns.ax': 'http://openid.net/srv/ax/1.0', 'openid.ax.mode': 'fetch_request', 'openid.ax.required': 'email,fullname,old_email,firstname,old_nickname,lastname,old_fullname,nickname', 'openid.ax.type.fullname': 'http://axschema.org/namePerson', 'openid.ax.type.lastname': 'http://axschema.org/namePerson/last', 'openid.ax.type.firstname': 'http://axschema.org/namePerson/first', 'openid.ax.type.nickname': 'http://axschema.org/namePerson/friendly', 'openid.ax.type.email': 'http://axschema.org/contact/email', 'openid.ax.type.old_email': 'http://schema.openid.net/contact/email', 'openid.ax.type.old_nickname': 'http://schema.openid.net/namePerson/friendly', 'openid.ax.type.old_fullname': 'http://schema.openid.net/namePerson'}
    for key in kwargs:
        args[('openid.' + key)] = kwargs[key]
    if (login_method == 'POST'):
        resp = self.client.post(url, args)
    elif (login_method == 'GET'):
        resp = self.client.get(url, args)
    else:
        self.fail('Invalid    login    method')
    code = expected_code
    self.assertEqual(resp.status_code, code, "got    code    {0}    for    url    '{1}'.    Expected    code    {2}".format(resp.status_code, url, code))
