owenrusk.dev

errands

small jobs the runtime does for the studio.

git clone https://owenrusk.dev/errands.git

commit 28fe2d0afa324d87310e2d4739d0f6c8d8ec08ae
parent b3cbde9abe67bb812b592b5545a151e00e54ec9a
author Owen Rusk <owen@papermothgames.com>
date   2025-08-19 13:25:55 -0500
vault: notes as well as logins
errands/vault.py+7-0
tests/test_vault.py+5-0
diff --git a/errands/vault.py b/errands/vault.py
index 3346fe2..f42617a 100644
--- a/errands/vault.py
+++ b/errands/vault.py
@@ -47,6 +47,9 @@ class Vault:
     def username(self, name: str) -> str:
         return self.item(name)["login"]["username"]
 
+    def note(self, name: str) -> str:
+        return self.item(name).get("notes") or ""
+
 
 _vault: Vault | None = None
 
@@ -64,3 +67,7 @@ def password(name: str) -> str:
 
 def username(name: str) -> str:
     return default().username(name)
+
+
+def note(name: str) -> str:
+    return default().note(name)
diff --git a/tests/test_vault.py b/tests/test_vault.py
index 074dd52..e855872 100644
--- a/tests/test_vault.py
+++ b/tests/test_vault.py
@@ -8,6 +8,7 @@ from errands import settings, vault
 
 ITEMS = [
     {"name": "stillwater api", "login": {"username": "papermoth", "password": "not-a-real-token"}, "notes": None},
+    {"name": "wifi", "login": None, "notes": "office network: see the sticker on the router"},
     {"name": "stillwater api (old)", "login": {"username": "papermoth", "password": "older"}, "notes": None},
 ]
 
@@ -59,6 +60,10 @@ class VaultTest(unittest.TestCase):
         self.vault.password("stillwater api")
         self.assertIn(["list", "items", "--search", "stillwater api"], self.bw.calls)
 
+    def test_note(self):
+        self.assertEqual(self.vault.note("wifi"), "office network: see the sticker on the router")
+        self.assertEqual(self.vault.note("stillwater api"), "")
+
     def test_missing(self):
         with self.assertRaises(LookupError):
             self.vault.password("nothing like it")