def test_tu_voteinfo_null_submitter_raises(user: User):
    with pytest.raises(IntegrityError):
        with db.begin():
            create(TUVoteInfo,
                   Agenda="Blah blah.",
                   User=user.Username,
                   Submitted=0,
                   End=0,
                   Quorum=0.50)
    rollback()
Beispiel #2
0
def test_invalid_ban():
    with pytest.raises(sa_exc.IntegrityError):
        bad_ban = Ban(BanTS=datetime.utcnow())

        # We're adding a ban with no primary key; this causes an
        # SQLAlchemy warnings when committing to the DB.
        # Ignore them.
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", sa_exc.SAWarning)
            with db.begin():
                db.add(bad_ban)

    # Since we got a transaction failure, we need to rollback.
    db.rollback()
Beispiel #3
0
def test_package_base_ci(user: User, pkgbase: PackageBase):
    """ Test case insensitivity of the database table. """
    with pytest.raises(IntegrityError):
        with db.begin():
            db.create(PackageBase, Name=pkgbase.Name.upper(), Maintainer=user)
    db.rollback()