Beispiel #1
0
    def test_crowd_user_get(self):
        from ptah.crowd.provider import CrowdUser, Session

        user = CrowdUser('user-name', 'user-login', 'user-email', 'passwd')
        uri = user.uri

        Session.add(user)
        Session.flush()

        self.assertEqual(CrowdUser.get(user.pid).uri, uri)
        self.assertEqual(CrowdUser.get_byuri(user.uri).uri, uri)
        self.assertEqual(CrowdUser.get_bylogin(user.login).uri, uri)
Beispiel #2
0
        f = ModifyUserForm(None, None)

        request = DummyRequest(
            POST = {'form.buttons.remove': 'Remove',
                    ModifyUserForm.csrfname: f.token})
        wrapper = UserWrapper(user, request)

        view = ModifyUserForm(wrapper, request)
        try:
            view.update()
        except Exception, res:
            pass
        self.assertIsInstance(res, HTTPFound)
        self.assertEqual(res.headers['location'], '..')

        user = CrowdUser.get_byuri(user.uri)
        self.assertIsNone(user)


class TestChangePassword(Base):

    def _user(self):
        from ptah.crowd.provider import CrowdUser, Session
        user = CrowdUser('name', 'ptah@local', 'ptah@local')
        uri = user.uri
        Session.add(user)
        Session.flush()
        return user

    def test_change_password_user_back(self):
        from ptah.crowd.module import UserWrapper