test(api): isolate identity lookup from runtime database
This commit is contained in:
1 parent
4c4c38f987
commit
d69c2afe9a
1 file changed
+4
@@ -1,9 +1,12 @@
|
|||||||
import unittest
|
import unittest
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from tempfile import TemporaryDirectory
|
from tempfile import TemporaryDirectory
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from app.belki import api
|
||||||
from app.belki.api import ApiError, calculate_payload, inspect_bulk_payload, resolve_identity_payload
|
from app.belki.api import ApiError, calculate_payload, inspect_bulk_payload, resolve_identity_payload
|
||||||
from app.belki.history import CalculationStore
|
from app.belki.history import CalculationStore
|
||||||
|
from app.belki.identity import IdentityDirectory
|
||||||
|
|
||||||
|
|
||||||
class ApiTests(unittest.TestCase):
|
class ApiTests(unittest.TestCase):
|
||||||
@@ -49,6 +52,7 @@ class ApiTests(unittest.TestCase):
|
|||||||
self.assertTrue(response["questions"])
|
self.assertTrue(response["questions"])
|
||||||
|
|
||||||
def test_identity_resolution_without_directory_requests_missing_half(self):
|
def test_identity_resolution_without_directory_requests_missing_half(self):
|
||||||
|
with patch.object(api, "_IDENTITY_DIRECTORY", IdentityDirectory()):
|
||||||
response = resolve_identity_payload({"character_id": 1617140})
|
response = resolve_identity_payload({"character_id": 1617140})
|
||||||
self.assertEqual(response["status"], "needs_input")
|
self.assertEqual(response["status"], "needs_input")
|
||||||
self.assertIn("имя", response["message"].lower())
|
self.assertIn("имя", response["message"].lower())
|
||||||
|
|||||||
Reference in new issue
Block a user