Exemplo n.º 1
0
    def test_add_group(self, db_session):
        group = Group(group_name="example group", description="example description")
        db_session.add(group)
        db_session.flush()

        group = db_session.query(Group)
        group = group.filter(Group.group_name == "example group").first()

        assert group.group_name == "example group"
        assert group.description == "example description"
        assert group.member_count == 0
    def test_add_group(self, db_session):
        group = Group(
            group_name='example group',
            description='example description'
        )
        db_session.add(group)
        db_session.flush()

        group = db_session.query(Group)
        group = group.filter(Group.group_name == 'example group').first()

        assert group.group_name == 'example group'
        assert group.description == 'example description'
        assert group.member_count == 0
Exemplo n.º 3
0
def add_group(db_session, group_name="group", description="desc"):
    group = Group(group_name=group_name, description=description)
    test_perm = GroupPermission(perm_name="manage_apps")
    group.permissions.append(test_perm)
    db_session.add(group)
    db_session.flush()
    return group
Exemplo n.º 4
0
def add_group(db_session, group_name='group', description='desc'):
    group = Group(group_name=group_name, description=description)
    test_perm = GroupPermission(perm_name='manage_apps')
    group.permissions.append(test_perm)
    db_session.add(group)
    db_session.flush()
    return group
Exemplo n.º 5
0
    def test_all(self, db_session):
        group1 = add_group(db_session, "group1")
        group2 = add_group(db_session, "group2")

        all_groups = Group.all(db_session=db_session).all()

        assert len(all_groups) == 2
        assert all_groups[0] == group1
        assert all_groups[1] == group2
    def test_by_group_name_wrong_groupname(self, db_session):
        add_group(db_session, )
        queried_group = Group.by_group_name('not existing group',
                                            db_session=db_session)

        assert queried_group is None
    def test_by_group_name(self, db_session):
        added_group = add_group(db_session, )
        queried_group = Group.by_group_name('group',
                                            db_session=db_session)

        assert added_group == queried_group
    def test_by_group_name_wrong_groupname(self, db_session):
        add_group(db_session, )
        queried_group = Group.by_group_name('not existing group',
                                            db_session=db_session)

        assert queried_group is None
    def test_by_group_name(self, db_session):
        added_group = add_group(db_session, )
        queried_group = Group.by_group_name('group',
                                            db_session=db_session)

        assert added_group == queried_group