Exemplo n.º 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([]))
Exemplo n.º 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'})
Exemplo n.º 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([]))
Exemplo n.º 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([]))
Exemplo n.º 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([]))
Exemplo n.º 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([]))
Exemplo n.º 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'})
Exemplo n.º 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([]))