Logo Search packages:      
Sourcecode: ubuntu-sso-client version File versions  Download package

def ubuntu_sso::tests::test_auth::AuthorisationClientTests::test_ensure_access_token_no_token (   self  ) 

If the user has no token, a new one is requested and stored, via
   an OAuth callback to the internal webserver.

Definition at line 175 of file test_auth.py.

00175                                                :
        """If the user has no token, a new one is requested and stored, via
           an OAuth callback to the internal webserver."""

        self.mock_no_token(gnomekeyring.NoMatchError)

        request_token = self.mocker.mock()
        self.expect(request_token.key).result('access_key').count(0, None)
        ex = self.expect(request_token.secret)
        ex.result('access_secret').count(0, None)
        make_token_request = self.mocker.mock()
        self.expect(make_token_request(ANY)).result(request_token)

        open_in_browser = self.mocker.mock()
        open_in_browser(ANY)

        ri = self.mocker.replace("random.randint")
        ri(1000000, 10000000)
        self.mocker.result(12345678)
        get_temporary_httpd = self.mocker.mock()
        get_temporary_httpd(12345678, ANY, True)
        self.mocker.result("http://callbackurl")

        self.replay(callback_parent=lambda a: None)

        self.client.make_token_request = make_token_request
        self.client.open_in_browser = open_in_browser
        self.client.get_temporary_httpd = get_temporary_httpd
        # skip the "are we online, via networkmanager" bit
        self.client.acquire_access_token_if_online = \
            self.client.acquire_access_token
        self.client.ensure_access_token()
    test_ensure_access_token_no_token.skip = \
        "Fails with exceptions.AssertionError: [Mocker] Unmet expectations, "\


Generated by  Doxygen 1.6.0   Back to index