Example #1
0
    def test_other_user_role(self):
        user_to_update = User(password='******', id='uid2')
        user_doing_update = User(password='******', id='uid')

        result = yield user_to_update.can_update(user_doing_update,
                                                 first_name='TestName')
        assert result == (False, set([]))
Example #2
0
    def test_current_user_role(self):
        user = User(password='******', id='uid')

        result = yield user.can_update(user,
                                       first_name='TestName',
                                       role='administrator')
        assert result == (False, {'role'})
Example #3
0
    def test_sys_admin(self):
        user_to_update = User(password='******', id='uid2')
        user_doing_update = User(password='******',
                                 role='administrator',
                                 id='uid')

        result = yield user_to_update.can_update(user_doing_update,
                                                 first_name='TestName')
        assert result == (True, set([]))
Example #4
0
    def test_current_user(self):
        user = User(password='******', id='uid')

        result = yield user.can_update(user, first_name='TestName')
        assert result == (True, set([]))
Example #5
0
    def test_other_user_role(self):
        user_to_update = User(password='******', id='uid2')
        user_doing_update = User(password='******', id='uid')

        result = yield user_to_update.can_update(user_doing_update, first_name='TestName')
        assert result == (False, set([]))
Example #6
0
    def test_sys_admin_role(self):
        user_to_update = User(password='******', id='uid2')
        user_doing_update = User(password='******', role='administrator', id='uid')

        result = yield user_to_update.can_update(user_doing_update, first_name='TestName', role='administrator')
        assert result == (True, set([]))
Example #7
0
    def test_current_user_role(self):
        user = User(password='******', id='uid')

        result = yield user.can_update(user, first_name='TestName', role='administrator')
        assert result == (False, {'role'})
Example #8
0
    def test_current_user(self):
        user = User(password='******', id='uid')

        result = yield user.can_update(user, first_name='TestName')
        assert result == (True, set([]))