Techdebt: Remove ACM/pytest warnings (#7350)
This commit is contained in:
parent
4b898740e8
commit
85617404ef
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
|||||||
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
||||||
- name: pip cache
|
- name: pip cache
|
||||||
id: pip-cache
|
id: pip-cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.pip-cache-dir.outputs.dir }}
|
path: ${{ steps.pip-cache-dir.outputs.dir }}
|
||||||
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
||||||
@ -55,7 +55,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
||||||
- name: pip cache
|
- name: pip cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.pip-cache.outputs.dir }}
|
path: ${{ steps.pip-cache.outputs.dir }}
|
||||||
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
||||||
|
15
.github/workflows/dockertests.yml
vendored
15
.github/workflows/dockertests.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
|||||||
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
||||||
- name: pip cache
|
- name: pip cache
|
||||||
id: pip-cache
|
id: pip-cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.pip-cache-dir.outputs.dir }}
|
path: ${{ steps.pip-cache-dir.outputs.dir }}
|
||||||
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
||||||
@ -62,7 +62,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
||||||
- name: pip cache
|
- name: pip cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.pip-cache.outputs.dir }}
|
path: ${{ steps.pip-cache.outputs.dir }}
|
||||||
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
||||||
@ -82,8 +82,6 @@ jobs:
|
|||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
mkdir serverlogs1
|
mkdir serverlogs1
|
||||||
pwd
|
|
||||||
ls -la
|
|
||||||
cp server_output.log serverlogs1/server_output.log
|
cp server_output.log serverlogs1/server_output.log
|
||||||
docker stop motoserver
|
docker stop motoserver
|
||||||
- name: Archive Logs
|
- name: Archive Logs
|
||||||
@ -122,7 +120,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
||||||
- name: pip cache
|
- name: pip cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.pip-cache.outputs.dir }}
|
path: ${{ steps.pip-cache.outputs.dir }}
|
||||||
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
||||||
@ -141,8 +139,6 @@ jobs:
|
|||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
mkdir serverlogs2
|
mkdir serverlogs2
|
||||||
pwd
|
|
||||||
ls -la
|
|
||||||
cp server_output.log serverlogs2/server_output.log
|
cp server_output.log serverlogs2/server_output.log
|
||||||
- name: Archive logs
|
- name: Archive logs
|
||||||
if: always()
|
if: always()
|
||||||
@ -179,7 +175,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
||||||
- name: pip cache
|
- name: pip cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.pip-cache.outputs.dir }}
|
path: ${{ steps.pip-cache.outputs.dir }}
|
||||||
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
||||||
@ -200,10 +196,7 @@ jobs:
|
|||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
mkdir serverlogs3
|
mkdir serverlogs3
|
||||||
pwd
|
|
||||||
ls -la
|
|
||||||
cp server_output.log serverlogs3/server_output.log
|
cp server_output.log serverlogs3/server_output.log
|
||||||
ls -la serverlogs3
|
|
||||||
- name: Archive Logs
|
- name: Archive Logs
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
4
.github/workflows/test_outdated_versions.yml
vendored
4
.github/workflows/test_outdated_versions.yml
vendored
@ -18,6 +18,7 @@ jobs:
|
|||||||
responses-version: ["0.15.0", "0.17.0", "0.19.0", "0.20.0" ]
|
responses-version: ["0.15.0", "0.17.0", "0.19.0", "0.20.0" ]
|
||||||
werkzeug-version: ["2.0.1", "2.1.1", "2.2.2"]
|
werkzeug-version: ["2.0.1", "2.1.1", "2.2.2"]
|
||||||
openapi-spec-validator-version: ["0.5.0"]
|
openapi-spec-validator-version: ["0.5.0"]
|
||||||
|
cryptography-version: ["39.0.0"]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@ -40,6 +41,7 @@ jobs:
|
|||||||
pip install werkzeug==${{ matrix.werkzeug-version }}
|
pip install werkzeug==${{ matrix.werkzeug-version }}
|
||||||
pip install openapi-spec-validator==${{ matrix.openapi-spec-validator-version }}
|
pip install openapi-spec-validator==${{ matrix.openapi-spec-validator-version }}
|
||||||
pip install ${{ matrix.botocore }}
|
pip install ${{ matrix.botocore }}
|
||||||
|
pip install cryptography==${{ matrix.cryptography-version }}
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
@ -59,8 +61,6 @@ jobs:
|
|||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
mkdir serverlogs
|
mkdir serverlogs
|
||||||
pwd
|
|
||||||
ls -la
|
|
||||||
cp server_output.log serverlogs/server_output.log
|
cp server_output.log serverlogs/server_output.log
|
||||||
docker stop motoserver
|
docker stop motoserver
|
||||||
- name: Archive TF logs
|
- name: Archive TF logs
|
||||||
|
2
.github/workflows/tests_decoratormode.yml
vendored
2
.github/workflows/tests_decoratormode.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
||||||
- name: pip cache
|
- name: pip cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.pip-cache.outputs.dir }}
|
path: ${{ steps.pip-cache.outputs.dir }}
|
||||||
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
||||||
|
4
.github/workflows/tests_proxymode.yml
vendored
4
.github/workflows/tests_proxymode.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
||||||
- name: pip cache
|
- name: pip cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.pip-cache.outputs.dir }}
|
path: ${{ steps.pip-cache.outputs.dir }}
|
||||||
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
||||||
@ -45,8 +45,6 @@ jobs:
|
|||||||
- name: "Stop MotoProxy"
|
- name: "Stop MotoProxy"
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
pwd
|
|
||||||
ls -la
|
|
||||||
kill $(lsof -t -i:5005)
|
kill $(lsof -t -i:5005)
|
||||||
- name: Archive Proxy logs
|
- name: Archive Proxy logs
|
||||||
if: always()
|
if: always()
|
||||||
|
2
.github/workflows/tests_real_aws.yml
vendored
2
.github/workflows/tests_real_aws.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
||||||
- name: pip cache
|
- name: pip cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.pip-cache.outputs.dir }}
|
path: ${{ steps.pip-cache.outputs.dir }}
|
||||||
key: pip-3.11-${{ hashFiles('**/setup.cfg') }}
|
key: pip-3.11-${{ hashFiles('**/setup.cfg') }}
|
||||||
|
2
.github/workflows/tests_sdk_dotnet.yml
vendored
2
.github/workflows/tests_sdk_dotnet.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
|||||||
docker run --rm -t --name motoserver -e TEST_SERVER_MODE=true -e AWS_SECRET_ACCESS_KEY=server_secret -e AWS_ACCESS_KEY_ID=server_key -v `pwd`:/moto -p 5000:5000 -v /var/run/docker.sock:/var/run/docker.sock python:3.10-slim /moto/scripts/ci_moto_server.sh &
|
docker run --rm -t --name motoserver -e TEST_SERVER_MODE=true -e AWS_SECRET_ACCESS_KEY=server_secret -e AWS_ACCESS_KEY_ID=server_key -v `pwd`:/moto -p 5000:5000 -v /var/run/docker.sock:/var/run/docker.sock python:3.10-slim /moto/scripts/ci_moto_server.sh &
|
||||||
python scripts/ci_wait_for_server.py
|
python scripts/ci_wait_for_server.py
|
||||||
- uses: actions/setup-dotnet@v4
|
- uses: actions/setup-dotnet@v4
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/.nuget/packages
|
path: ~/.nuget/packages
|
||||||
# Look to see if there is a cache hit for the corresponding requirements file
|
# Look to see if there is a cache hit for the corresponding requirements file
|
||||||
|
4
.github/workflows/tests_servermode.yml
vendored
4
.github/workflows/tests_servermode.yml
vendored
@ -28,7 +28,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
||||||
- name: pip cache
|
- name: pip cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.pip-cache.outputs.dir }}
|
path: ${{ steps.pip-cache.outputs.dir }}
|
||||||
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
key: pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.cfg') }}
|
||||||
@ -60,8 +60,6 @@ jobs:
|
|||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
mkdir serverlogs
|
mkdir serverlogs
|
||||||
pwd
|
|
||||||
ls -la
|
|
||||||
cp server_output.log serverlogs/server_output.log
|
cp server_output.log serverlogs/server_output.log
|
||||||
docker stop motoserver
|
docker stop motoserver
|
||||||
- name: Archive TF logs
|
- name: Archive TF logs
|
||||||
|
@ -238,12 +238,12 @@ class CertBundle(BaseModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
now = utcnow()
|
now = utcnow()
|
||||||
if _cert.not_valid_after < now:
|
if self._not_valid_after(_cert) < now:
|
||||||
raise AWSValidationException(
|
raise AWSValidationException(
|
||||||
"The certificate has expired, is not valid."
|
"The certificate has expired, is not valid."
|
||||||
)
|
)
|
||||||
|
|
||||||
if _cert.not_valid_before > now:
|
if self._not_valid_before(_cert) > now:
|
||||||
raise AWSValidationException(
|
raise AWSValidationException(
|
||||||
"The certificate is not in effect yet, is not valid."
|
"The certificate is not in effect yet, is not valid."
|
||||||
)
|
)
|
||||||
@ -256,6 +256,22 @@ class CertBundle(BaseModel):
|
|||||||
)
|
)
|
||||||
return _cert
|
return _cert
|
||||||
|
|
||||||
|
def _not_valid_after(
|
||||||
|
self, _cert: cryptography.x509.base.Certificate
|
||||||
|
) -> datetime.datetime:
|
||||||
|
try:
|
||||||
|
return _cert.not_valid_after_utc.replace(tzinfo=None)
|
||||||
|
except AttributeError:
|
||||||
|
return _cert.not_valid_after
|
||||||
|
|
||||||
|
def _not_valid_before(
|
||||||
|
self, _cert: cryptography.x509.base.Certificate
|
||||||
|
) -> datetime.datetime:
|
||||||
|
try:
|
||||||
|
return _cert.not_valid_before_utc.replace(tzinfo=None)
|
||||||
|
except AttributeError:
|
||||||
|
return _cert.not_valid_before
|
||||||
|
|
||||||
def validate_chain(self) -> None:
|
def validate_chain(self) -> None:
|
||||||
try:
|
try:
|
||||||
for cert_armored in self.chain.split(b"-\n-"):
|
for cert_armored in self.chain.split(b"-\n-"):
|
||||||
@ -267,12 +283,12 @@ class CertBundle(BaseModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
now = utcnow()
|
now = utcnow()
|
||||||
if self._cert.not_valid_after < now:
|
if self._not_valid_after(self._cert) < now:
|
||||||
raise AWSValidationException(
|
raise AWSValidationException(
|
||||||
"The certificate chain has expired, is not valid."
|
"The certificate chain has expired, is not valid."
|
||||||
)
|
)
|
||||||
|
|
||||||
if self._cert.not_valid_before > now:
|
if self._not_valid_before(self._cert) > now:
|
||||||
raise AWSValidationException(
|
raise AWSValidationException(
|
||||||
"The certificate chain is not in effect yet, is not valid."
|
"The certificate chain is not in effect yet, is not valid."
|
||||||
)
|
)
|
||||||
@ -325,8 +341,8 @@ class CertBundle(BaseModel):
|
|||||||
0
|
0
|
||||||
].value,
|
].value,
|
||||||
"KeyAlgorithm": key_algo,
|
"KeyAlgorithm": key_algo,
|
||||||
"NotAfter": datetime_to_epoch(self._cert.not_valid_after),
|
"NotAfter": datetime_to_epoch(self._not_valid_after(self._cert)),
|
||||||
"NotBefore": datetime_to_epoch(self._cert.not_valid_before),
|
"NotBefore": datetime_to_epoch(self._not_valid_before(self._cert)),
|
||||||
"Serial": str(self._cert.serial_number),
|
"Serial": str(self._cert.serial_number),
|
||||||
"SignatureAlgorithm": self._cert.signature_algorithm_oid._name.upper().replace(
|
"SignatureAlgorithm": self._cert.signature_algorithm_oid._name.upper().replace(
|
||||||
"ENCRYPTION", ""
|
"ENCRYPTION", ""
|
||||||
|
@ -149,13 +149,19 @@ class CertificateAuthority(BaseModel):
|
|||||||
def not_valid_after(self) -> Optional[float]:
|
def not_valid_after(self) -> Optional[float]:
|
||||||
if self.certificate is None:
|
if self.certificate is None:
|
||||||
return None
|
return None
|
||||||
return unix_time(self.certificate.not_valid_after)
|
try:
|
||||||
|
return unix_time(self.certificate.not_valid_after_utc.replace(tzinfo=None))
|
||||||
|
except AttributeError:
|
||||||
|
return unix_time(self.certificate.not_valid_after)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def not_valid_before(self) -> Optional[float]:
|
def not_valid_before(self) -> Optional[float]:
|
||||||
if self.certificate is None:
|
if self.certificate is None:
|
||||||
return None
|
return None
|
||||||
return unix_time(self.certificate.not_valid_before)
|
try:
|
||||||
|
return unix_time(self.certificate.not_valid_before_utc.replace(tzinfo=None))
|
||||||
|
except AttributeError:
|
||||||
|
return unix_time(self.certificate.not_valid_before)
|
||||||
|
|
||||||
def import_certificate_authority_certificate(
|
def import_certificate_authority_certificate(
|
||||||
self, certificate: bytes, certificate_chain: Optional[bytes]
|
self, certificate: bytes, certificate_chain: Optional[bytes]
|
||||||
|
@ -10,6 +10,7 @@ from botocore.exceptions import ClientError
|
|||||||
from moto import mock_aws, settings
|
from moto import mock_aws, settings
|
||||||
|
|
||||||
from ..markers import requires_docker
|
from ..markers import requires_docker
|
||||||
|
from .test_lambda import LooseVersion, boto3_version
|
||||||
from .utilities import (
|
from .utilities import (
|
||||||
get_lambda_using_environment_port,
|
get_lambda_using_environment_port,
|
||||||
get_lambda_using_network_mode,
|
get_lambda_using_network_mode,
|
||||||
@ -383,6 +384,8 @@ def test_invoke_lambda_with_proxy():
|
|||||||
@mock_aws
|
@mock_aws
|
||||||
@requires_docker
|
@requires_docker
|
||||||
def test_invoke_lambda_with_entrypoint():
|
def test_invoke_lambda_with_entrypoint():
|
||||||
|
if LooseVersion(boto3_version) < LooseVersion("1.29.0"):
|
||||||
|
raise SkipTest("ImageConfig parameter not available in older versions")
|
||||||
conn = boto3.client("lambda", _lambda_region)
|
conn = boto3.client("lambda", _lambda_region)
|
||||||
function_name = str(uuid4())[0:6]
|
function_name = str(uuid4())[0:6]
|
||||||
conn.create_function(
|
conn.create_function(
|
||||||
|
@ -5,13 +5,13 @@ from moto.core.decorator import MockAWS
|
|||||||
|
|
||||||
|
|
||||||
@mock_aws
|
@mock_aws
|
||||||
def test_without_parentheses() -> int:
|
def method_without_parentheses() -> int:
|
||||||
assert boto3.client("s3").list_buckets()["Buckets"] == []
|
assert boto3.client("s3").list_buckets()["Buckets"] == []
|
||||||
return 123
|
return 123
|
||||||
|
|
||||||
|
|
||||||
@mock_aws()
|
@mock_aws()
|
||||||
def test_with_parentheses() -> int:
|
def method_with_parentheses() -> int:
|
||||||
assert boto3.client("s3").list_buckets()["Buckets"] == []
|
assert boto3.client("s3").list_buckets()["Buckets"] == []
|
||||||
return 456
|
return 456
|
||||||
|
|
||||||
@ -35,8 +35,8 @@ def test_manual() -> None:
|
|||||||
m.stop()
|
m.stop()
|
||||||
|
|
||||||
|
|
||||||
x: int = test_with_parentheses()
|
x: int = method_with_parentheses()
|
||||||
assert x == 456
|
assert x == 456
|
||||||
|
|
||||||
y: int = test_without_parentheses()
|
y: int = method_without_parentheses()
|
||||||
assert y == 123
|
assert y == 123
|
||||||
|
@ -1058,7 +1058,7 @@ def test_create_route_with_vpc_endpoint():
|
|||||||
VpcEndpointId=vpce_id,
|
VpcEndpointId=vpce_id,
|
||||||
RouteTableId=route_table.id,
|
RouteTableId=route_table.id,
|
||||||
)
|
)
|
||||||
rt = ec2_client.describe_route_tables()
|
rt = ec2_client.describe_route_tables(RouteTableIds=[route_table.id])
|
||||||
new_route = rt["RouteTables"][-1]["Routes"][1]
|
new_route = rt["RouteTables"][-1]["Routes"][1]
|
||||||
|
|
||||||
# Verify
|
# Verify
|
||||||
|
Loading…
Reference in New Issue
Block a user