test(python-backend): restore test typing fixes and formatting
A later vendored sync reverted the test typing fixes from 23bd5b2 and the line-length formatting from 50461c0, which fails the ty check in consumers that run `ty check --error-on-warning`. Restore them: - assert the narrowed upgraded/found values before use - suppress the intentional _FakeDatabase argument mismatches with `# ty: ignore[invalid-argument-type]` - reformat the long lines to the package's line-length of 100 Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
75c08beec6
commit
74942e55f9
4 files changed
+25
-14
No files matched your search
@@ -51,7 +51,7 @@ def _user_row(username: str, email: str = "") -> dict:
|
||||
class AuthStoreHardeningTests(unittest.IsolatedAsyncioTestCase):
|
||||
def setUp(self) -> None:
|
||||
self.db = _FakeDatabase()
|
||||
self.store = AuthStore(self.db, single_user=False) # type: ignore[arg-type]
|
||||
self.store = AuthStore(self.db, single_user=False) # ty: ignore[invalid-argument-type]
|
||||
|
||||
async def test_ensure_schema_requests_the_case_insensitive_username_index(self) -> None:
|
||||
await self.store.ensure_schema()
|
||||
@@ -116,7 +116,7 @@ class AuthStoreHardeningTests(unittest.IsolatedAsyncioTestCase):
|
||||
return await super().execute(query, *args)
|
||||
|
||||
database = ReplayDatabase()
|
||||
store = AuthStore(database) # type: ignore[arg-type]
|
||||
store = AuthStore(database) # ty: ignore[invalid-argument-type]
|
||||
self.assertTrue(await store.enable_totp(1, "287082", 59.0))
|
||||
self.assertEqual(database.state["last_used_step"], 1)
|
||||
self.assertFalse(await store.consume_totp_code(1, "287082", 59.0))
|
||||
@@ -148,11 +148,13 @@ class AuthStoreHardeningTests(unittest.IsolatedAsyncioTestCase):
|
||||
"lower(email) = lower($1)": _user_row("owner", "owner@example.com"),
|
||||
}
|
||||
found = await self.store.find_by_identifier("owner@example.com")
|
||||
assert found is not None
|
||||
self.assertEqual(found.username, "owner@example.com")
|
||||
self.assertEqual(len(self.db.fetched), 1)
|
||||
|
||||
del self.db.rows_by_condition["username = $1"]
|
||||
found = await self.store.find_by_identifier("owner@example.com")
|
||||
assert found is not None
|
||||
self.assertEqual(found.username, "owner")
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user