Skip to content

Commit 34043a2

Browse files
regorganize tests
Signed-off-by: Ramon Petgrave <[email protected]>
1 parent 73eaf0e commit 34043a2

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed

test/unit/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def ctx_cls():
214214
return ctx_cls, IdentityToken(token)
215215

216216

217-
@pytest.fixture
217+
@pytest.fixture(scope="session")
218218
def staging() -> tuple[type[SigningContext], type[Verifier], IdentityToken]:
219219
"""
220220
Returns a SigningContext, Verifier, and IdentityToken for the staging environment.

test/unit/internal/rekor/test_client_v2.py

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import hashlib
2-
import os
32
import secrets
43

54
import pytest
6-
from id import (
7-
detect_credential,
8-
)
95

106
from sigstore import dsse
11-
from sigstore._internal.rekor.client import STAGING_REKOR_URL
7+
from sigstore._internal.rekor.client import DEFAULT_REKOR_URL, STAGING_REKOR_URL
128
from sigstore._internal.rekor.client_v2 import (
139
DEFAULT_KEY_DETAILS,
1410
Certificate,
@@ -20,11 +16,9 @@
2016
v2,
2117
v2_intoto,
2218
)
23-
from sigstore._internal.trust import ClientTrustConfig
2419
from sigstore._utils import sha256_digest
2520
from sigstore.models import rekor_v1
26-
from sigstore.oidc import _DEFAULT_AUDIENCE, IdentityToken
27-
from sigstore.sign import SigningContext, ec
21+
from sigstore.sign import ec
2822

2923
ALPHA_REKOR_V2_URL = "https://log2025-alpha1.rekor.sigstage.dev"
3024
LOCAL_REKOR_V2_URL = "http://localhost:3000"
@@ -37,8 +31,8 @@
3731
params=[
3832
ALPHA_REKOR_V2_URL,
3933
pytest.param(STAGING_REKOR_URL, marks=pytest.mark.xfail),
40-
# pytest.param(DEFAULT_REKOR_URL, marks=pytest.mark.xfail),
41-
# pytest.param(LOCAL_REKOR_V2_URL, marks=pytest.mark.xfail),
34+
pytest.param(DEFAULT_REKOR_URL, marks=pytest.mark.skip),
35+
pytest.param(LOCAL_REKOR_V2_URL, marks=pytest.mark.skip),
4236
],
4337
)
4438
def client(request) -> RekorV2Client:
@@ -50,19 +44,14 @@ def client(request) -> RekorV2Client:
5044

5145

5246
@pytest.fixture(scope="session")
53-
def sample_cert_and_private_key() -> tuple[Certificate, ec.EllipticCurvePrivateKey]:
47+
def sample_cert_and_private_key(
48+
staging,
49+
) -> tuple[Certificate, ec.EllipticCurvePrivateKey]:
5450
"""
5551
Returns a sample Certificate and ec.EllipticCurvePrivateKey.
5652
"""
57-
# Detect env variable for local interactive tests.
58-
token = os.getenv("SIGSTORE_IDENTITY_TOKEN_staging")
59-
if not token:
60-
# If the variable is not defined, try getting an ambient token.
61-
token = detect_credential(_DEFAULT_AUDIENCE)
62-
63-
with SigningContext.from_trust_config(ClientTrustConfig.staging()).signer(
64-
IdentityToken(token)
65-
) as signer:
53+
sign_ctx_cls, _, identity = staging
54+
with sign_ctx_cls().signer(identity) as signer:
6655
return signer._signing_cert(), signer._private_key
6756

6857

0 commit comments

Comments
 (0)