def test_get_by_id(self):
        """Get group by ID."""
        group = StudentGroups.create(name="testgroup", owner_id=1)
        group.save()

        retrieved = StudentGroups.get_by_id(group.id)
        assert retrieved == group
    def test_groupname_is_unique(self, db):
        """Test unique group names only"""
        group = StudentGroups.create(name="testgroup", owner_id=1, code=grc())
        group.save()
        group2 = None
        with pytest.raises(exc.IntegrityError):
            group2 = StudentGroups.create(name="testgroup",
                                          owner_id=2,
                                          code=grc())
            group2.save()

        assert group is not None
        assert group2 is None
Beispiel #3
0
def create_all_group(id):
    StudentGroups.create(name="ALL", owner_id=id, code="", hidden=True)
    def test_hidden_defaults_to_false(self):
        """Test that hidden attribute defaults to false"""
        group = StudentGroups.create(name="testgroup", owner_id=1, code=grc())
        group.save()

        assert group.hidden is False