test: migrate oauth tests to testcontainers#33973
Merged
asukaminato0721 merged 6 commits intoMar 24, 2026
Merged
Conversation
Daedalus-Icarus
requested review from
QuantumGhost and
laipz8200
as code owners
March 23, 2026 18:33
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-23 18:35:04.244083734 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-23 18:34:54.557135726 +0000
@@ -792,6 +792,12 @@
--> tests/test_containers_integration_tests/conftest.py:198:39
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/controllers/console/app/test_chat_conversation_status_count_api.py:33:48
+ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
+ --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:198:9
+ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
+ --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:199:9
+ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
+ --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:436:20
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/controllers/console/helpers.py:40:48
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
@@ -1974,10 +1980,6 @@
--> tests/unit_tests/controllers/console/auth/test_login_logout.py:467:16
ERROR `None` is not subscriptable [unsupported-operation]
--> tests/unit_tests/controllers/console/auth/test_login_logout.py:495:16
-ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
- --> tests/unit_tests/controllers/console/auth/test_oauth.py:206:9
-ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
- --> tests/unit_tests/controllers/console/auth/test_oauth.py:207:9
ERROR Object of class `tuple` has no attribute `json` [missing-attribute]
--> tests/unit_tests/controllers/console/auth/test_token_refresh.py:74:16
ERROR Type `Response` is not iterable [not-iterable]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-23 18:37:15.544768008 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-23 18:37:06.633640752 +0000
@@ -792,6 +792,12 @@
--> tests/test_containers_integration_tests/conftest.py:198:39
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/controllers/console/app/test_chat_conversation_status_count_api.py:33:48
+ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
+ --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:196:9
+ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
+ --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:197:9
+ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
+ --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:432:20
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/controllers/console/helpers.py:40:48
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
@@ -1974,10 +1980,6 @@
--> tests/unit_tests/controllers/console/auth/test_login_logout.py:467:16
ERROR `None` is not subscriptable [unsupported-operation]
--> tests/unit_tests/controllers/console/auth/test_login_logout.py:495:16
-ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
- --> tests/unit_tests/controllers/console/auth/test_oauth.py:206:9
-ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
- --> tests/unit_tests/controllers/console/auth/test_oauth.py:207:9
ERROR Object of class `tuple` has no attribute `json` [missing-attribute]
--> tests/unit_tests/controllers/console/auth/test_token_refresh.py:74:16
ERROR Type `Response` is not iterable [not-iterable]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-23 18:51:17.874306814 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-23 18:51:07.770284015 +0000
@@ -792,6 +792,10 @@
--> tests/test_containers_integration_tests/conftest.py:198:39
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/controllers/console/app/test_chat_conversation_status_count_api.py:33:48
+ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
+ --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:196:9
+ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
+ --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:197:9
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/controllers/console/helpers.py:40:48
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
@@ -1974,10 +1978,6 @@
--> tests/unit_tests/controllers/console/auth/test_login_logout.py:467:16
ERROR `None` is not subscriptable [unsupported-operation]
--> tests/unit_tests/controllers/console/auth/test_login_logout.py:495:16
-ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
- --> tests/unit_tests/controllers/console/auth/test_oauth.py:206:9
-ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
- --> tests/unit_tests/controllers/console/auth/test_oauth.py:207:9
ERROR Object of class `tuple` has no attribute `json` [missing-attribute]
--> tests/unit_tests/controllers/console/auth/test_token_refresh.py:74:16
ERROR Type `Response` is not iterable [not-iterable]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-24 03:20:07.323950115 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-24 03:19:58.414835500 +0000
@@ -792,6 +792,10 @@
--> tests/test_containers_integration_tests/conftest.py:198:39
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/controllers/console/app/test_chat_conversation_status_count_api.py:33:48
+ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
+ --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:196:9
+ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
+ --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:197:9
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/controllers/console/helpers.py:40:48
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
@@ -1974,10 +1978,6 @@
--> tests/unit_tests/controllers/console/auth/test_login_logout.py:467:16
ERROR `None` is not subscriptable [unsupported-operation]
--> tests/unit_tests/controllers/console/auth/test_login_logout.py:495:16
-ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
- --> tests/unit_tests/controllers/console/auth/test_oauth.py:206:9
-ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
- --> tests/unit_tests/controllers/console/auth/test_oauth.py:207:9
ERROR Object of class `tuple` has no attribute `json` [missing-attribute]
--> tests/unit_tests/controllers/console/auth/test_token_refresh.py:74:16
ERROR Type `Response` is not iterable [not-iterable]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-24 03:22:32.049237689 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-24 03:22:21.810162489 +0000
@@ -792,6 +792,10 @@
--> tests/test_containers_integration_tests/conftest.py:198:39
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/controllers/console/app/test_chat_conversation_status_count_api.py:33:48
+ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
+ --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:196:9
+ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
+ --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:197:9
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/controllers/console/helpers.py:40:48
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
@@ -1974,10 +1978,6 @@
--> tests/unit_tests/controllers/console/auth/test_login_logout.py:467:16
ERROR `None` is not subscriptable [unsupported-operation]
--> tests/unit_tests/controllers/console/auth/test_login_logout.py:495:16
-ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
- --> tests/unit_tests/controllers/console/auth/test_oauth.py:206:9
-ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
- --> tests/unit_tests/controllers/console/auth/test_oauth.py:207:9
ERROR Object of class `tuple` has no attribute `json` [missing-attribute]
--> tests/unit_tests/controllers/console/auth/test_token_refresh.py:74:16
ERROR Type `Response` is not iterable [not-iterable]
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-24 12:29:44.945544666 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-24 12:29:35.496453685 +0000
@@ -792,6 +792,10 @@
--> tests/test_containers_integration_tests/conftest.py:198:39
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/controllers/console/app/test_chat_conversation_status_count_api.py:33:48
+ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
+ --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:196:9
+ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
+ --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:197:9
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/controllers/console/helpers.py:40:48
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
@@ -1982,10 +1986,6 @@
--> tests/unit_tests/controllers/console/auth/test_login_logout.py:467:16
ERROR `None` is not subscriptable [unsupported-operation]
--> tests/unit_tests/controllers/console/auth/test_login_logout.py:495:16
-ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
- --> tests/unit_tests/controllers/console/auth/test_oauth.py:206:9
-ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
- --> tests/unit_tests/controllers/console/auth/test_oauth.py:207:9
ERROR Object of class `tuple` has no attribute `json` [missing-attribute]
--> tests/unit_tests/controllers/console/auth/test_token_refresh.py:74:16
ERROR Type `Response` is not iterable [not-iterable]
|
Contributor
Author
|
@asukaminato0721 Could you please take a look on this PR? |
asukaminato0721
approved these changes
Mar 24, 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.
Important
Fixes #<issue number>.Summary
Migrate OAuth controller tests from mock-based unit tests to testcontainers integration
tests by moving
test_oauth.pyfromunit_tests/totest_containers_integration_tests/.Key changes:
Flask(__name__)fixtures withflask_app_with_containersdbandSessionmock patches (8 occurrences) — real DB session is now availableget_account_by_email_with_case_fallbacktest to query real PostgreSQLinstead of mocking
session.executeside effects_get_account_by_openid_or_emailtest by removingSessioncontext manager mockPart of #32454
Screenshots
Checklist
make lintandmake type-check(backend) andcd web && npx lint-staged(frontend) to appease the lint gods