Skip to content

Commit f89328c

Browse files
author
Kairo de Araujo
committed
Add tests warehouse.tuf.repository
Added unit tests for warehouse.tuf.repository Signed-off-by: Kairo de Araujo <[email protected]>
1 parent eff11dd commit f89328c

File tree

3 files changed

+879
-10
lines changed

3 files changed

+879
-10
lines changed

tests/conftest.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from pytest_postgresql.config import get_config
3535
from pytest_postgresql.janitor import DatabaseJanitor
3636
from sqlalchemy import event
37+
from tuf.api.metadata import StorageBackendInterface
3738

3839
import warehouse
3940

@@ -44,6 +45,8 @@
4445
from warehouse.email.interfaces import IEmailSender
4546
from warehouse.macaroons import services as macaroon_services
4647
from warehouse.metrics import IMetricsService
48+
from warehouse.tuf.interfaces import IKeyService
49+
from warehouse.tuf.repository import MetadataRepository
4750

4851
from .common.db import Session
4952

@@ -351,6 +354,18 @@ def xmlrpc(self, path, method, *args):
351354
return xmlrpc.client.loads(resp.body)
352355

353356

357+
@pytest.fixture
358+
def tuf_repository():
359+
class FakeStorageBackend(StorageBackendInterface):
360+
pass
361+
362+
class FakeKeyBackend(IKeyService):
363+
pass
364+
365+
tuf_repo = MetadataRepository(FakeStorageBackend, FakeKeyBackend)
366+
return tuf_repo
367+
368+
354369
@pytest.fixture
355370
def webtest(app_config):
356371
# TODO: Ensure that we have per test isolation of the database level

0 commit comments

Comments
 (0)