import pytest from peewee import IntegrityError from data.model.repository import create_repository, purge_repository, is_empty from test.fixtures import * def test_duplicate_repository_different_kinds(initialized_db): # Create an image repo. create_repository('devtable', 'somenewrepo', None, repo_kind='image') # Try to create an app repo with the same name, which should fail. with pytest.raises(IntegrityError): create_repository('devtable', 'somenewrepo', None, repo_kind='application') def test_is_empty(initialized_db): create_repository('devtable', 'somenewrepo', None, repo_kind='image') assert is_empty('devtable', 'somenewrepo') assert not is_empty('devtable', 'simple')