示例#1
0
def property_group_grant_property(group_id, property_name):
    property_group = PropertyGroup.q.get(group_id)

    if property_group is None:
        flash(u"Eigenschaftengruppe mit ID {} existiert nicht!".format(group_id), 'error')
        abort(404)

    grant_property(property_group, property_name)
    session.session.commit()
    message = u'Eigenschaft {0} der Gruppe {1} gewährt.'
    flash(message.format(property_name, property_group.name), 'success')
    return redirect(url_for('.property_groups'))
示例#2
0
    def test_0010_grant_property(self):
        prop = grant_property(self.group, self.property_name)

        assert Property.get(prop.id) is not None

        db_property = Property.get(prop.id)

        assert db_property.name == self.property_name
        assert db_property.property_group == self.group
        assert db_property.granted
        assert self.group.property_grants[self.property_name]

        session.session.delete(db_property)
        session.session.commit()
示例#3
0
    def test_0010_grant_property(self):
        prop = grant_property(self.group, self.property_name)

        self.assertIsNotNone(Property.q.get(prop.id))

        db_property = Property.q.get(prop.id)

        self.assertEqual(db_property.name, self.property_name)
        self.assertEqual(db_property.property_group, self.group)
        self.assertTrue(db_property.granted)
        self.assertTrue(self.group.property_grants[self.property_name])

        session.session.delete(db_property)
        session.session.commit()
示例#4
0
    def test_0010_grant_property(self):
        prop = grant_property(self.group, self.property_name)

        self.assertIsNotNone(Property.q.get(prop.id))

        db_property = Property.q.get(prop.id)

        self.assertEqual(db_property.name, self.property_name)
        self.assertEqual(db_property.property_group, self.group)
        self.assertTrue(db_property.granted)
        self.assertTrue(self.group.property_grants[self.property_name])

        session.session.delete(db_property)
        session.session.commit()