feat(client): expose secret-free profile summary
This commit is contained in:
@@ -112,6 +112,30 @@ class LocalStateStoreTests(unittest.TestCase):
|
||||
finally:
|
||||
os.chdir(original_cwd)
|
||||
|
||||
def test_profile_summary_reads_settings_and_token_presence_without_unprotect(self) -> None:
|
||||
class NoUnprotectProtector(FakeProtector):
|
||||
def unprotect(self, ciphertext: bytes, *, purpose: str) -> bytes:
|
||||
raise AssertionError("metadata_read_must_not_unprotect")
|
||||
|
||||
summary_store = LocalStateStore(
|
||||
self.database,
|
||||
NoUnprotectProtector(),
|
||||
now=lambda: self.clock[0],
|
||||
)
|
||||
summary = summary_store.load_profile_summary(PROFILE)
|
||||
self.assertEqual(summary.settings, settings())
|
||||
self.assertTrue(summary.has_stored_device_token)
|
||||
self.assertNotIn(DEVICE_TOKEN, repr(summary))
|
||||
|
||||
def test_profile_summary_missing_profile_fails_without_creating_defaults(self) -> None:
|
||||
with self.assertRaisesRegex(StateError, "profile_not_found"):
|
||||
self.store.load_profile_summary("missing")
|
||||
connection = sqlite3.connect(self.database)
|
||||
try:
|
||||
self.assertEqual(connection.execute("SELECT count(*) FROM profiles").fetchone()[0], 1)
|
||||
finally:
|
||||
connection.close()
|
||||
|
||||
def test_empty_allows_new_key_but_terminal_does_not(self) -> None:
|
||||
self.store.start_or_resume_polling(PROFILE)
|
||||
first = self.store.prepare_claim(PROFILE)
|
||||
|
||||
Reference in New Issue
Block a user