import pytest from Crypto.PublicKey import RSA from jwkest.jwk import RSAKey from test.registry.protocols import Image, layer_bytes_for_contents from test.registry.protocol_v1 import V1Protocol from test.registry.protocol_v2 import V2Protocol @pytest.fixture(scope="session") def basic_images(): """ Returns basic images for push and pull testing. """ # Note: order is from base layer down to leaf. return [ Image(id='parentid', bytes=layer_bytes_for_contents('parent contents'), parent_id=None, size=None), Image(id='someid', bytes=layer_bytes_for_contents('some contents'), parent_id='parentid', size=None), ] @pytest.fixture(scope="session") def jwk(): return RSAKey(key=RSA.generate(2048)) @pytest.fixture(params=[V1Protocol, V2Protocol]) def pusher(request, jwk): return request.param(jwk) @pytest.fixture(params=[V1Protocol, V2Protocol]) def puller(request, jwk): return request.param(jwk)