fix(secretsmanager): fix update of no-value initial secret (#6771)
This commit is contained in:
parent
3256af7454
commit
49f5a48f71
@ -126,9 +126,12 @@ class FakeSecret:
|
||||
if "AWSPREVIOUS" in old_version["version_stages"]:
|
||||
old_version["version_stages"].remove("AWSPREVIOUS")
|
||||
|
||||
# set old AWSCURRENT secret to AWSPREVIOUS
|
||||
previous_current_version_id = self.default_version_id
|
||||
self.versions[previous_current_version_id]["version_stages"] = ["AWSPREVIOUS"] # type: ignore
|
||||
if self.default_version_id:
|
||||
# set old AWSCURRENT secret to AWSPREVIOUS
|
||||
previous_current_version_id = self.default_version_id
|
||||
self.versions[previous_current_version_id]["version_stages"] = [
|
||||
"AWSPREVIOUS"
|
||||
]
|
||||
|
||||
self.versions[version_id] = secret_version
|
||||
self.default_version_id = version_id
|
||||
|
@ -292,6 +292,22 @@ def test_create_secret_without_value():
|
||||
assert set(deleted.keys()) == {"ARN", "Name", "DeletionDate", "ResponseMetadata"}
|
||||
|
||||
|
||||
@mock_secretsmanager
|
||||
def test_create_secret_that_has_no_value_and_then_update():
|
||||
conn = boto3.client("secretsmanager", region_name="us-west-2")
|
||||
|
||||
conn.create_secret(Name="secret-no-value")
|
||||
|
||||
conn.update_secret(
|
||||
SecretId="secret-no-value",
|
||||
SecretString="barsecret",
|
||||
Description="desc",
|
||||
)
|
||||
|
||||
secret = conn.get_secret_value(SecretId="secret-no-value")
|
||||
assert secret["SecretString"] == "barsecret"
|
||||
|
||||
|
||||
@mock_secretsmanager
|
||||
def test_update_secret_without_value():
|
||||
conn = boto3.client("secretsmanager", region_name="us-east-2")
|
||||
|
Loading…
Reference in New Issue
Block a user