feat: Absender/Titel frei wählbar, kein "Notruf"-Default mehr (0.1.2)
"Notruf" war als Library/CLI-Default falsch — das gehört in die Bridge-Config, nicht ins Allzweck-Tool. Jetzt: - kein eingebauter Default-Absender; ohne Angabe nutzt seven.io den Kontostandard-Absender (send_sms lässt "from" dann weg) - CLI --from für SMS (Absender/Titel) und Voice (Caller-ID); zusätzlich $SEVEN_SMS_FROM / $SEVEN_VOICE_FROM als persistenter Default - Tests: Default ohne Absender, per-call-Override, CLI --from + Env (19 gesamt) - README: Absender/Titel dokumentiert Die Bridge übergibt sms_from="Notruf" weiterhin explizit -> Voice Assistant unverändert. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
fad93e194f
commit
1344d1f7e9
7 changed files with 64 additions and 10 deletions
|
|
@ -51,3 +51,27 @@ def test_cli_missing_key(monkeypatch, capsys):
|
|||
rc = cli.main(["sms", "--to", "+49", "--text", "Hi"])
|
||||
assert rc == 2
|
||||
assert "Konfig-Fehler" in capsys.readouterr().err
|
||||
|
||||
|
||||
def test_cli_sms_from_flag(monkeypatch):
|
||||
monkeypatch.delenv("SEVEN_SMS_FROM", raising=False)
|
||||
cap = []
|
||||
_patch(monkeypatch, cap)
|
||||
cli.main(["--api-key", "k", "sms", "--to", "+49", "--text", "Hi", "--from", "Firma"])
|
||||
assert cap[0]["data"]["from"] == "Firma"
|
||||
|
||||
|
||||
def test_cli_sms_no_from_by_default(monkeypatch):
|
||||
monkeypatch.delenv("SEVEN_SMS_FROM", raising=False)
|
||||
cap = []
|
||||
_patch(monkeypatch, cap)
|
||||
cli.main(["--api-key", "k", "sms", "--to", "+49", "--text", "Hi"])
|
||||
assert "from" not in cap[0]["data"]
|
||||
|
||||
|
||||
def test_cli_sms_from_env(monkeypatch):
|
||||
monkeypatch.setenv("SEVEN_SMS_FROM", "EnvAbs")
|
||||
cap = []
|
||||
_patch(monkeypatch, cap)
|
||||
cli.main(["--api-key", "k", "sms", "--to", "+49", "--text", "Hi"])
|
||||
assert cap[0]["data"]["from"] == "EnvAbs"
|
||||
|
|
|
|||
|
|
@ -54,6 +54,21 @@ def test_voice_no_ssml(monkeypatch):
|
|||
assert cap[0]["data"]["text"] == "roh"
|
||||
|
||||
|
||||
def test_send_sms_default_omits_sender(monkeypatch):
|
||||
# Ohne sms_from kein "from" -> seven.io nutzt den Kontostandard-Absender
|
||||
cap = []
|
||||
_patch_post(monkeypatch, cap, FakeResp(payload={"success": "100"}))
|
||||
SevenClient("key").send_sms("+49", "Hi")
|
||||
assert "from" not in cap[0]["data"]
|
||||
|
||||
|
||||
def test_send_sms_sender_override(monkeypatch):
|
||||
cap = []
|
||||
_patch_post(monkeypatch, cap, FakeResp(payload={"success": "100"}))
|
||||
SevenClient("key", sms_from="Firma").send_sms("+49", "Hi", sender="Aktion")
|
||||
assert cap[0]["data"]["from"] == "Aktion" # per-call schlägt Instanz-Default
|
||||
|
||||
|
||||
def test_failure_code(monkeypatch):
|
||||
cap = []
|
||||
_patch_post(monkeypatch, cap, FakeResp(payload={"success": "401"}))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue