Example #1
0
    def test_permissions_manage_paging(self):
        x = Permission.testing_create()
        y = Permission.testing_create()

        r = self.c.get('/permissions/manage?onpage=2&perpage=1')

        db.sess.add(x)
        db.sess.add(y)
        Permission.delete(x.id)
        Permission.delete(y.id)

        assert b'<h2>Manage Permissions</h2>' in r.data
Example #2
0
    def test_no_exc_with_user_permissions(self):
        u = User.testing_create()
        ap = Permission.testing_create()
        dp = Permission.testing_create()
        u.assign_permissions([ap.id], [dp.id])
        db.sess.commit()

        resp = self.tam.get('/users/permissions/{0}'.format(u.id))
        assert b'<h1>Permissions for: ' in resp

        d = resp.pyq
        assert str(d('td.approved a[href="/users/edit/{0}"]'.format(u.id)))
        assert str(d('td.denied a[href="/users/edit/{0}"]'.format(u.id)))
Example #3
0
    def test_no_exc_with_group_permissions(self):
        g = Group.testing_create()
        ap = Permission.testing_create()
        dp = Permission.testing_create()
        g.assign_permissions([ap.id], [dp.id])
        u = User.testing_create(groups=g)

        resp = self.tam.get('/users/permissions/{0}'.format(u.id))
        assert b'<h1>Permissions for: ' in resp

        d = resp.pyq
        db.sess.add(g)
        assert str(d('td.approved a[href="/groups/edit/{0}"]'.format(g.id)))
        assert str(d('td.denied a[href="/groups/edit/{0}"]'.format(g.id)))