test: migrate workspace wraps controller tests to testcontainers#34296
Merged
asukaminato0721 merged 4 commits intolanggenius:mainfrom Mar 30, 2026
Conversation
Contributor
Pyrefly DiffNo changes detected. |
Contributor
|
Since it's container, I prefer don't mock the db |
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-30 15:04:44.648223521 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-30 15:04:33.830053488 +0000
@@ -669,6 +669,8 @@
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]
+ --> tests/test_containers_integration_tests/controllers/console/workspace/test_workspace_wraps.py:18: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]
--> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:95:20
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/core/app/layers/test_pause_state_persist_layer.py:104:20
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-30 15:06:43.721772585 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-30 15:06:32.965746019 +0000
@@ -669,6 +669,8 @@
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]
+ --> tests/test_containers_integration_tests/controllers/console/workspace/test_workspace_wraps.py:17: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]
--> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:95:20
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/core/app/layers/test_pause_state_persist_layer.py:104:20
|
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates the plugin_permission_required decorator tests for the console workspace controller from unit tests to the testcontainers-based integration test suite, aligning with the ongoing effort to reduce heavy DB patching and exercise real database behavior.
Changes:
- Removed the unit test module for workspace permission wrapping.
- Added a new testcontainers integration test module validating
plugin_permission_requiredagainst a real DB session/engine.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| api/tests/unit_tests/controllers/console/workspace/test_workspace_wraps.py | Removed the previous unit-test-based coverage for plugin_permission_required. |
| api/tests/test_containers_integration_tests/controllers/console/workspace/test_workspace_wraps.py | Reintroduced the decorator tests under the testcontainers integration test suite, creating real Tenant / TenantPluginPermission records. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
auto-merge was automatically disabled
March 30, 2026 15:48
Head branch was pushed to by a user without write access
Contributor
Pyrefly DiffNo changes detected. |
asukaminato0721
approved these changes
Mar 30, 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/controllers/console/workspace/test_workspace_wraps.pyto testcontainers integration tests atapi/tests/test_containers_integration_tests/controllers/console/workspace/test_workspace_wraps.py.Moved the file as-is : tests already use
from __future__ import annotationsand don't depend onFlask(__name__). All 7 tests migrated:plugin_permission_requireddecorator tests covering install permission (nobody forbidden, admin requires admin, admin allows admin), debug permission (nobody forbidden, admin requires admin), and no-permission passthrough. Session and db remain monkeypatched as tests verify decorator permission logic.Part of #32454
Checklist
make lintandmake type-check(backend) andcd web && npx lint-staged(frontend) to appease the lint gods