23c19bcbc1
This change implements support for registry integration tests using the new py.test-based live server test fixture. We can now parametrize the protocols we use (in prep for V2_2), and it makes the code *much* cleaner and less hacky. Note that moving the vast majority of the tests over from the existing impl will come as a followup PR
35 lines
948 B
Python
35 lines
948 B
Python
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)
|