コード例 #1
0
    def setUp(self):
        super(AuthorizationCodeTest, self).setUp()

        self.code_01 = {
            'code': u'some_random_stuff',
            'state': u'another_random_stuff',
            'user_id': 1
        }

        users.user_create({"fullname": "Test User"})
コード例 #2
0
ファイル: test_tasks.py プロジェクト: ColdrickSotK/storyboard
    def setUp(self):
        super(TasksTest, self).setUp()

        self.task_01 = {
            'title': u'Invent time machine',
            'status': 'todo',
            'story_id': 1
        }

        stories.story_create({"name": "Test Story"})
        users.user_create({"fullname": "Test User"})
コード例 #3
0
    def setUp(self):
        super(TokenTest, self).setUp()

        self.token_01 = {
            "access_token": u'an_access_token',
            "expires_in": 3600,
            "expires_at": datetime.now(pytz.utc),
            "user_id": 1
        }

        users.user_create({"fullname": "Test User"})
コード例 #4
0
    def save_authorization_code(self, client_id, code, request, *args,
                                **kwargs):
        """Save the code to the storage and remove the state as it is persisted
        in the "code" argument
        """

        openid = request._params["openid.claimed_id"]
        email = request._params["openid.sreg.email"]
        full_name = request._params["openid.sreg.fullname"]
        last_login = datetime.datetime.now(pytz.utc)

        user = user_api.user_get_by_openid(openid)
        user_dict = {"full_name": full_name,
                     "email": email,
                     "last_login": last_login}

        if not user:
            user_dict.update({"openid": openid})
            user = user_api.user_create(user_dict)
        else:
            user = user_api.user_update(user.id, user_dict)

        # def save_authorization_code(self, authorization_code, user_id):
        values = {
            "code": code["code"],
            "state": code["state"],
            "user_id": user.id,
            "expires_in": CONF.oauth.authorization_code_ttl
        }
        auth_api.authorization_code_save(values)
コード例 #5
0
ファイル: users.py プロジェクト: devcurmudgeon/storyboard
    def post(self, user):
        """Create a new user.

        :param user: A user within the request body.
        """

        created_user = users_api.user_create(user.as_dict())
        return wmodels.User.from_db_model(created_user)
コード例 #6
0
ファイル: users.py プロジェクト: openstack-infra/storyboard
    def post(self, user):
        """Create a new user.
           This command is only available to Admin users.

        Example::

          TODO

        :param user: A user within the request body.
        """

        created_user = users_api.user_create(user.as_dict())
        return wmodels.User.from_db_model(created_user)