test(sms): regression tests for code-review fixes
Lock the behaviors changed by the review-fix commit + the security invariants: - ManagementActorTests: UpdateSms/SmtpConfig now require Administrator (updated the existing success cases from Designer); + UpdateSmsConfig_WithDesignerRole_Returns Unauthorized and _WithEmptyAuthToken_PreservesExistingToken regression tests. - SecretEncryptionTests: SmsConfiguration.AuthToken stored-encrypted round-trip + null round-trip (AccountSid stays plaintext) — guards ApplySecretColumnEncryption. - ArtifactDiffTests: CompareSmsConfiguration New/Identical/Modified + the secret presence-only invariant (value never echoed, presence-flip shows <present> only). - UpdateCommandContractTests: notification sms update core fields Required, --auth-token optional. - NotificationListsPageTests: SMS recipient badge shows phone, not "Name <>". - NotificationOutboxActorDispatchTests: SMS-typed notification routes to the SMS adapter (StubAdapter.Type made configurable), not the Email adapter. - NotificationRecipientTests (new): ForEmail/ForSms + public-ctor invariants.
This commit is contained in:
@@ -83,6 +83,21 @@ public class UpdateCommandContractTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SmsUpdate_CoreFieldsRequired()
|
||||
{
|
||||
// `notification sms update` is a whole-replace of the SMS provider config, so its
|
||||
// identity + non-secret core fields must be Required — a missing --account-sid or
|
||||
// --from-number would otherwise send null and wipe a stored value. --auth-token
|
||||
// stays optional (preserve-if-omitted; empty == omitted, never "clear").
|
||||
var update = UpdateCommand(NotificationCommands.Build(Url, Format, Username, Password), "sms", "update");
|
||||
AssertRequired(update, "--id", "--account-sid", "--from-number");
|
||||
|
||||
var authToken = update.Options.SingleOrDefault(o => o.Name == "--auth-token");
|
||||
Assert.True(authToken != null, "sms update is missing option '--auth-token'.");
|
||||
Assert.False(authToken!.Required, "sms update '--auth-token' must be optional (preserve-if-omitted).");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ApiMethodUpdate_CoreFieldsRequired()
|
||||
=> AssertRequired(UpdateCommand(ApiMethodCommands.Build(Url, Format, Username, Password), "update"), "--script");
|
||||
|
||||
Reference in New Issue
Block a user