DEBUG: Test all RPC methods against PR #4451 changes#109
Closed
atodorov wants to merge 2 commits into
Closed
Conversation
This commit adds a comprehensive integration test that exercises ALL RPC methods exposed by Kiwi TCMS. It is designed to validate compatibility with the django-modern-rpc v2.1.0 migration in PR #4451, which changes: - from: modernrpc.core.rpc_method + @permissions_required + **kwargs - to: tcms.rpc.views.rpc_method with auth= and context_target= The test covers read-only operations (filter), write operations (create, update, remove), and RPC methods that use **kwargs/rpc_context for request access (add_tag, add_comment, etc.). Write operations that fail due to missing permissions are caught and asserted as expected (returning PermissionDenied), because the goal is to verify that the RPC method is reachable and responds correctly, not to bypass security. This is a DEBUG commit and should be reverted after the PR #4451 changes are verified.
| doesn't have sufficient permissions. | ||
| """ | ||
|
|
||
| import os |
| self.rpc.TestCase.add_tag(case_id, tag_name) | ||
| try: | ||
| self.rpc.TestCase.remove_tag(case_id, tag_name) | ||
| except Exception: |
| self.rpc.TestPlan.add_tag(plan_id, tag_name) | ||
| try: | ||
| self.rpc.TestPlan.remove_tag(plan_id, tag_name) | ||
| except Exception: |
| self.assertIsNotNone(result) | ||
| try: | ||
| self.rpc.TestRun.remove_tag(run_id, tag_name) | ||
| except Exception: |
| self.rpc.TestExecution.remove_comment( | ||
| exec_id, comment_result["id"] | ||
| ) | ||
| except Exception: |
for more information, see https://pre-commit.ci
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.
DEBUG Commit
This PR adds a comprehensive integration test that exercises ALL RPC methods exposed by Kiwi TCMS against the django-modern-rpc v2.1.0 migration in kiwitcms/Kiwi#4451.
What changed in PR #4451
The server-side RPC decorator pattern changed:
modernrpc.core.rpc_method+@permissions_required+**kwargswithREQUEST_KEYtcms.rpc.views.rpc_methodwithauth=andcontext_target=\rpc_context\What this tests
How to run
or
This is a DEBUG commit and should be reverted after verification is complete.