Example #1
0
    def testActivateAndRetrieve(self):
        self.StartObjectPatch(store, 'Refresh', autospec=True)

        refresh_token.ActivateCredentials('my-account', 'my-refresh-token')
        self.assertEqual('my-account', properties.VALUES.core.account.Get())

        self.assertEqual('my-refresh-token',
                         refresh_token.GetForAccount('my-account'))
    def Run(self, args):
        """Run the authentication command."""

        token = args.token or console_io.PromptResponse('Refresh token: ')
        if not token:
            raise c_exc.InvalidArgumentException('token', 'No value provided.')

        refresh_token.ActivateCredentials(args.account, token)

        project = args.project
        if project:
            properties.PersistProperty(properties.VALUES.core.project, project)

        log.status.Print('Activated refresh token credentials: [{0}]'.format(
            args.account))