Use centralized ACCOUNT_ID (#4029)

This commit is contained in:
Bert Blommers 2021-06-23 18:03:11 +01:00 committed by GitHub
commit 5e4bccc22d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 22 deletions

View file

@ -4,6 +4,7 @@ from __future__ import unicode_literals
import boto3
from moto import mock_secretsmanager, mock_lambda, settings
from moto.core import ACCOUNT_ID
from botocore.exceptions import ClientError
import string
import pytz
@ -30,11 +31,15 @@ def test_get_secret_value():
def test_get_secret_value_by_arn():
conn = boto3.client("secretsmanager", region_name="us-west-2")
name = "java-util-test-password"
secret_value = "test_get_secret_value_by_arn"
result = conn.create_secret(
Name="java-util-test-password", SecretString=secret_value
result = conn.create_secret(Name=name, SecretString=secret_value)
arn = result["ARN"]
arn.should.match(
"^arn:aws:secretsmanager:us-west-2:{}:secret:{}".format(ACCOUNT_ID, name)
)
result = conn.get_secret_value(SecretId=result["ARN"])
result = conn.get_secret_value(SecretId=arn)
assert result["SecretString"] == secret_value