aurweb/test/test_package_blacklist.py
Kevin Morris 735c5f57cb
housekeep(fastapi): rewrite test_package_blacklist
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-12-01 00:28:40 -08:00

23 lines
559 B
Python

import pytest
from sqlalchemy.exc import IntegrityError
from aurweb import db
from aurweb.models.package_blacklist import PackageBlacklist
@pytest.fixture(autouse=True)
def setup(db_test):
return
def test_package_blacklist_creation():
with db.begin():
package_blacklist = db.create(PackageBlacklist, Name="evil-package")
assert bool(package_blacklist.ID)
assert package_blacklist.Name == "evil-package"
def test_package_blacklist_null_name_raises_exception():
with pytest.raises(IntegrityError):
PackageBlacklist()