Skip to content

Commit

Permalink
fix pkgpush tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nl0 committed Apr 8, 2024
1 parent 96d6d73 commit b36ae20
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lambdas/pkgpush/tests/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
from unittest import mock

import boto3
import pytest
from botocore.stub import Stubber

import quilt_shared.aws
import t4_lambda_pkgpush
from quilt3.backends import get_package_registry
from quilt3.packages import Package, PackageEntry
from quilt3.util import PhysicalKey
from quilt_shared.aws import AWSCredentials
from quilt_shared.types import NonEmptyStr


def hash_data(data):
Expand All @@ -24,12 +24,14 @@ def hash_data(data):
calculate_sha256_patcher = functools.partial(mock.patch, 'quilt3.packages.calculate_sha256')


CREDENTIALS = quilt_shared.aws.AWSCredentials(
key='test_aws_access_key_id',
secret='test_aws_secret_access_key',
token='test_aws_session_token',
CREDENTIALS = AWSCredentials(
key=NonEmptyStr("test_aws_access_key_id"),
secret=NonEmptyStr("test_aws_secret_access_key"),
token=NonEmptyStr("test_aws_session_token"),
)

SCRATCH_BUCKETS = {"us-east-1": "test-scratch-bucket"}


class PackagePromoteTestBase(unittest.TestCase):
credentials = CREDENTIALS
Expand Down Expand Up @@ -139,7 +141,7 @@ def setUp(self):
self.get_user_boto_session_mock = get_user_boto_session_patcher.start()
self.addCleanup(get_user_boto_session_patcher.stop)

def calculate_pkg_hashes_side_effect(pkg):
def calculate_pkg_hashes_side_effect(pkg, scratch_buckets):
for lk, entry in pkg.walk():
if entry.hash is None:
entry.hash = {
Expand Down Expand Up @@ -547,6 +549,7 @@ def setUpClass(cls):
'bucket': cls.dst_bucket,
'message': cls.dst_commit_message,
'user_meta': cls.meta,
'scratch_buckets': SCRATCH_BUCKETS,
}
cls.gen_params = staticmethod(cls.make_params_factory(cls.params))
cls.gen_pkg_entry = staticmethod(cls.make_params_factory(cls.package_entry))
Expand Down Expand Up @@ -741,6 +744,7 @@ def test_invalid_entries_missing_required_props(self):
'name': 'user/atestpackage',
'bucket': self.dst_bucket,
'message': 'test package',
'scratch_buckets': SCRATCH_BUCKETS,
},
entry,
])
Expand Down

0 comments on commit b36ae20

Please sign in to comment.