test: migrate api token service tests to testcontainers#34148
Merged
asukaminato0721 merged 2 commits intolanggenius:mainfrom Mar 26, 2026
Merged
Conversation
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-26 12:15:33.262688550 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-26 12:15:22.660707995 +0000
@@ -894,6 +894,8 @@
--> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:441:72
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:527:57
+ERROR Argument `Literal['app']` is not assignable to parameter `value` with type `ApiTokenType | SQLCoreOperations[ApiTokenType]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_api_token_service.py:27:26
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_app_dsl_service.py:112:42
ERROR Argument `Literal['workflow']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-26 12:17:35.057418480 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-26 12:17:24.464350484 +0000
@@ -894,6 +894,8 @@
--> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:441:72
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:527:57
+ERROR Argument `Literal['app']` is not assignable to parameter `value` with type `ApiTokenType | SQLCoreOperations[ApiTokenType]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+ --> tests/test_containers_integration_tests/services/test_api_token_service.py:27:26
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/test_app_dsl_service.py:112:42
ERROR Argument `Literal['workflow']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
|
Contributor
|
@YB0y Hi, how did you run workflow automatically? I enabled the workflow on my forked repo but the workflow doesn't work. |
asukaminato0721
approved these changes
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate tests from
api/tests/unit_tests/services/test_api_token_service.pyto testcontainers integration tests at
api/tests/test_containers_integration_tests/services/test_api_token_service.py.All 24 tests migrated. DB-dependent tests (query_token_from_db success and not-found paths) now use real PostgreSQL with ApiToken records instead of mocking Session/db. Redis cache tests and single-flight lock tests remain mocked as they test Redis-specific behavior. Deleted the unit test file.
Part of #32454
Checklist
make lintandmake type-check(backend) andcd web && npx lint-staged(frontend) to appease the lint gods