我需要将默认 AccountId 123456789012 更改为不同的值。
我试过这个夹具:
@pytest.fixture(autouse=True):
def sts(monkeypatch):
import moto.iam.models as models
monkeypatch.setattr(models,'ACCOUNT_ID','111111111111')
from moto import mock_sts
with mock_sts():
sts=boto3.client('sts',region_name='us-east-1')
assert(sts.get_caller_identity().get('Account')=='111111111111')
yield sts
但是该断言失败,AccountId 仍然是默认值...