Back to Black

This commit is contained in:
Matěj Cepl 2020-10-06 08:46:05 +02:00
commit 5697ff87a8
112 changed files with 1803 additions and 977 deletions

View file

@ -575,8 +575,10 @@ def test__delete_alias__raises_if_alias_is_not_found():
with pytest.raises(NotFoundException) as err:
kms.delete_alias(alias_name)
expected_message_match = r"Alias arn:aws:kms:{region}:[0-9]{{12}}:{alias_name} is not found.".format(
region=region, alias_name=alias_name
expected_message_match = (
r"Alias arn:aws:kms:{region}:[0-9]{{12}}:{alias_name} is not found.".format(
region=region, alias_name=alias_name
)
)
ex = err.value
ex.body["__type"].should.equal("NotFoundException")

View file

@ -55,14 +55,20 @@ def test_create_key():
key["KeyMetadata"]["Origin"].should.equal("AWS_KMS")
key["KeyMetadata"].should_not.have.key("SigningAlgorithms")
key = conn.create_key(KeyUsage="ENCRYPT_DECRYPT", CustomerMasterKeySpec="RSA_2048",)
key = conn.create_key(
KeyUsage="ENCRYPT_DECRYPT",
CustomerMasterKeySpec="RSA_2048",
)
sorted(key["KeyMetadata"]["EncryptionAlgorithms"]).should.equal(
["RSAES_OAEP_SHA_1", "RSAES_OAEP_SHA_256"]
)
key["KeyMetadata"].should_not.have.key("SigningAlgorithms")
key = conn.create_key(KeyUsage="SIGN_VERIFY", CustomerMasterKeySpec="RSA_2048",)
key = conn.create_key(
KeyUsage="SIGN_VERIFY",
CustomerMasterKeySpec="RSA_2048",
)
key["KeyMetadata"].should_not.have.key("EncryptionAlgorithms")
sorted(key["KeyMetadata"]["SigningAlgorithms"]).should.equal(
@ -77,21 +83,24 @@ def test_create_key():
)
key = conn.create_key(
KeyUsage="SIGN_VERIFY", CustomerMasterKeySpec="ECC_SECG_P256K1",
KeyUsage="SIGN_VERIFY",
CustomerMasterKeySpec="ECC_SECG_P256K1",
)
key["KeyMetadata"].should_not.have.key("EncryptionAlgorithms")
key["KeyMetadata"]["SigningAlgorithms"].should.equal(["ECDSA_SHA_256"])
key = conn.create_key(
KeyUsage="SIGN_VERIFY", CustomerMasterKeySpec="ECC_NIST_P384",
KeyUsage="SIGN_VERIFY",
CustomerMasterKeySpec="ECC_NIST_P384",
)
key["KeyMetadata"].should_not.have.key("EncryptionAlgorithms")
key["KeyMetadata"]["SigningAlgorithms"].should.equal(["ECDSA_SHA_384"])
key = conn.create_key(
KeyUsage="SIGN_VERIFY", CustomerMasterKeySpec="ECC_NIST_P521",
KeyUsage="SIGN_VERIFY",
CustomerMasterKeySpec="ECC_NIST_P521",
)
key["KeyMetadata"].should_not.have.key("EncryptionAlgorithms")
@ -101,7 +110,10 @@ def test_create_key():
@mock_kms
def test_describe_key():
client = boto3.client("kms", region_name="us-east-1")
response = client.create_key(Description="my key", KeyUsage="ENCRYPT_DECRYPT",)
response = client.create_key(
Description="my key",
KeyUsage="ENCRYPT_DECRYPT",
)
key_id = response["KeyMetadata"]["KeyId"]
response = client.describe_key(KeyId=key_id)