'Perform an OAuth authentication using the current web client.
This should add an AUTHORIZED_CLIENTS_SESSION_KEY entry to the current session.'

def authenticate_with_oauth(self, oauth_client):

    data = {'client_id': oauth_client.client_id, 'client_secret': oauth_client.client_secret, 'response_type': 'code'}
    self.client.post(reverse('oauth2:capture'), data, follow=True)
    self.assertListEqual(self.client.session[AUTHORIZED_CLIENTS_SESSION_KEY], [oauth_client.client_id])
