我有一个要测试的方法,它在多个秘密对象上调用 get_secret:
@pytest.fixture(scope="session")
def client():
conn = boto3.client("secretsmanager", region_name="us-west-1")
yield conn
@mock_secretsmanager
def test_get_secret_value(client):
client.create_secret(
Name="one", SecretString="sdfsdf"
)
client.create_secret(
Name="two", SecretString="werwewe"
)
# Function that gets value of 2 secrets- "one" and "two"
# Only "two" will exist as the second call to create_secret() will override the first it seems
mymodule.get_one_and_two("one","two")
我收到一个错误:botocore.errorfactory.ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the GetSecretValue operation: Secrets Manager can't find the specified secret
我是否错误地使用了moto?如何创建我的函数可以访问的两个秘密?
编辑
看起来这个问题应该已经解决了。我似乎仍然有这个问题:https ://github.com/spulec/moto/issues/1893