Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
di committed Aug 29, 2024
1 parent 17e9d45 commit c92f5e6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
30 changes: 16 additions & 14 deletions tests/functional/api/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,17 @@

import base64
import hashlib

from http import HTTPStatus

from ...common.db.packaging import (
ProjectFactory,
ReleaseFactory,
)
import pymacaroons

from warehouse.macaroons import caveats

from ...common.db.accounts import EmailFactory, UserFactory
from ...common.db.packaging import RoleFactory
from ...common.db.macaroons import MacaroonFactory
from ...common.db.oidc import GitHubPublisherFactory
from warehouse.macaroons import caveats

import pymacaroons
from ...common.db.packaging import ProjectFactory, ReleaseFactory, RoleFactory


def test_simple_api_html(webtest):
Expand All @@ -47,7 +45,10 @@ def test_simple_api_detail(webtest):

def test_simple_attestations_from_upload(webtest):
user = UserFactory.create(
password="$argon2id$v=19$m=1024,t=6,p=6$EiLE2Nsbo9S6N+acs/beGw$ccyZDCZstr1/+Y/1s3BVZHOJaqfBroT0JCieHug281c" # 'password'
password=( # 'password'
"$argon2id$v=19$m=1024,t=6,p=6$EiLE2Nsbo9S6N+acs/beGw$ccyZDCZstr1/+Y/1s3BVZ"
"HOJaqfBroT0JCieHug281c"
)
)
EmailFactory.create(user=user, verified=True)
project = ProjectFactory.create(name="sampleproject")
Expand Down Expand Up @@ -75,16 +76,15 @@ def test_simple_attestations_from_upload(webtest):
m.add_first_party_caveat(caveats.serialize(caveat))
serialized_macaroon = f"pypi-{m.serialize()}"

credentials = base64.b64encode(
f"__token__:{serialized_macaroon}".encode("utf-8")
).decode("utf-8")
credentials = base64.b64encode(f"__token__:{serialized_macaroon}".encode()).decode(
"utf-8"
)

with open("./tests/functional/_fixtures/sampleproject-3.0.0.tar.gz", "rb") as f:
content = f.read()

with open(
"./tests/functional/_fixtures/sampleproject-3.0.0.tar.gz.publish.attestation",
"r",
) as f:
attestation = f.read()

Expand All @@ -101,7 +101,9 @@ def test_simple_attestations_from_upload(webtest):
headers={"Authorization": f"Basic {credentials}"},
params={
"name": "sampleproject",
"sha256_digest": "117ed88e5db073bb92969a7545745fd977ee85b7019706dd256a64058f70963d",
"sha256_digest": (
"117ed88e5db073bb92969a7545745fd977ee85b7019706dd256a64058f70963d"
),
"filetype": "sdist",
"metadata_version": "2.1",
"version": "3.0.0",
Expand Down
3 changes: 2 additions & 1 deletion warehouse/forklift/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
import wtforms
import wtforms.validators

from pypi_attestations import Attestation, Distribution
from pydantic import TypeAdapter, ValidationError, VerificationError, Verifier
from pypi_attestations import Attestation, AttestationType, Distribution
from pyramid.httpexceptions import (
HTTPBadRequest,
HTTPException,
Expand Down

0 comments on commit c92f5e6

Please sign in to comment.