-
Notifications
You must be signed in to change notification settings - Fork 18
Support Baseline Id in lobster-codebeamer #587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
iceman-muc
wants to merge
12
commits into
main
Choose a base branch
from
feature/lobster-codebeamer-with-BaselineId
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c5b04dd
feat(codebeamer): add baseline_id support for tracker and cbQL queries
b5bdb30
docs: document baseline_id for lobster-codebeamer
da220d5
test: fix and extend unit tests for baseline_id in codebeamer
8d1fe85
Merge branch 'main' into feature/lobster-codebeamer-with-BaselineId
iceman-muc 53bfadb
fix: use f-string formatting in get_query str branch
iceman-muc 9b3a90b
fix(codebeamer): address PR #587 review - error on invalid baseline_i…
iceman-muc c6e5389
fix(test): use cbQL response format (unwrapped items) in baseline_id …
iceman-muc 1dc7054
ci: retrigger checks
iceman-muc 0ff14a6
Merge branch 'main' into feature/lobster-codebeamer-with-BaselineId
phiwuu 73b0a83
Merge branch 'main' into feature/lobster-codebeamer-with-BaselineId
iceman-muc 1f40db3
test(codebeamer): assert full error messages in baseline_id system tests
iceman-muc cba514c
Merge branch 'main' into feature/lobster-codebeamer-with-BaselineId
kedarnn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| import json | ||
| import unittest | ||
| from flask import Response | ||
| from tests_system.lobster_codebeamer.lobster_codebeamer_system_test_case_base import ( | ||
| LobsterCodebeamerSystemTestCaseBase) | ||
| from tests_system.asserter import Asserter | ||
| from tests_system.lobster_codebeamer.lobster_codebeamer_asserter import ( | ||
| LobsterCodebeamerAsserter) | ||
| from tests_system.lobster_codebeamer.mock_server_setup import get_mock_app | ||
|
|
||
|
|
||
| class LobsterCodebeamerBaselineIdTest(LobsterCodebeamerSystemTestCaseBase): | ||
| """System tests for baseline_id validation and usage.""" | ||
|
|
||
| @classmethod | ||
| def setUpClass(cls): | ||
| cls.codebeamer_flask = get_mock_app() | ||
|
|
||
| def setUp(self): | ||
| super().setUp() | ||
| self.codebeamer_flask.reset() | ||
| self._test_runner = self.create_test_runner() | ||
| self._test_runner.config_file_data.verify_ssl = False | ||
|
|
||
| def test_baseline_id_with_import_tagged_raises_error(self): | ||
| """Ensure baseline_id combined with import_tagged exits with error.""" | ||
| cfg = self._test_runner.config_file_data | ||
| cfg.set_default_root_token_out(self.codebeamer_flask.port) | ||
| cfg.import_tagged = "some_file.lobster" | ||
| cfg.baseline_id = 12345 | ||
|
|
||
| completed_process = self._test_runner.run_tool_test() | ||
| asserter = Asserter(self, completed_process, self._test_runner) | ||
| asserter.assertExitCode(1) | ||
| asserter.assertStdErrText( | ||
| "lobster-codebeamer: 'The keys baseline_id and import_tagged " | ||
| "are both present in the configuration, but they are mutually " | ||
| "exclusive!'\n" | ||
| ) | ||
|
|
||
| def test_baseline_id_with_numeric_import_query_raises_error(self): | ||
| """Ensure baseline_id combined with a numeric import_query exits | ||
| with error.""" | ||
| cfg = self._test_runner.config_file_data | ||
| cfg.set_default_root_token_out(self.codebeamer_flask.port) | ||
| cfg.import_query = 9999 | ||
| cfg.baseline_id = 12345 | ||
|
|
||
| completed_process = self._test_runner.run_tool_test() | ||
| asserter = Asserter(self, completed_process, self._test_runner) | ||
| asserter.assertExitCode(1) | ||
| asserter.assertStdErrText( | ||
| "lobster-codebeamer: 'The key baseline_id is only allowed if " | ||
| "import_query is a cbQL query string, not a numeric report ID!'\n" | ||
| ) | ||
|
|
||
| def test_baseline_id_negative_raises_error(self): | ||
| """Ensure a negative baseline_id exits with error.""" | ||
| cfg = self._test_runner.config_file_data | ||
| cfg.set_default_root_token_out(self.codebeamer_flask.port) | ||
| cfg.import_query = "tracker.id IN (123)" | ||
| cfg.baseline_id = -1 | ||
|
|
||
| completed_process = self._test_runner.run_tool_test() | ||
| asserter = Asserter(self, completed_process, self._test_runner) | ||
| asserter.assertExitCode(1) | ||
| asserter.assertStdErrText( | ||
| "lobster-codebeamer: baseline_id must be a positive integer.\n" | ||
| ) | ||
|
|
||
| def test_baseline_id_zero_raises_error(self): | ||
| """Ensure baseline_id of 0 exits with error.""" | ||
| cfg = self._test_runner.config_file_data | ||
| cfg.set_default_root_token_out(self.codebeamer_flask.port) | ||
| cfg.import_query = "tracker.id IN (123)" | ||
| cfg.baseline_id = 0 | ||
|
|
||
| completed_process = self._test_runner.run_tool_test() | ||
| asserter = Asserter(self, completed_process, self._test_runner) | ||
| asserter.assertExitCode(1) | ||
| asserter.assertStdErrText( | ||
| "lobster-codebeamer: baseline_id must be a positive integer.\n" | ||
| ) | ||
|
|
||
| def test_baseline_id_with_cbql_query_succeeds(self): | ||
| """Ensure baseline_id with a cbQL string query works and appends | ||
| baselineId to the URL.""" | ||
| cfg = self._test_runner.config_file_data | ||
| cfg.set_default_root_token_out(self.codebeamer_flask.port) | ||
| cfg.import_query = "tracker.id IN (123)" | ||
| cfg.baseline_id = 407126303 | ||
|
|
||
| response_data = { | ||
| 'page': 1, | ||
| 'pageSize': 1, | ||
| 'total': 1, | ||
| 'items': [ | ||
| { | ||
| 'id': 5, | ||
| 'name': 'Requirement 5: Dynamic name', | ||
| 'description': 'Dynamic description', | ||
| 'status': { | ||
| 'id': 5, | ||
| 'name': 'Status 5', | ||
| 'type': 'ChoiceOptionReference' | ||
| }, | ||
| 'tracker': { | ||
| 'id': 5, | ||
| 'name': 'Tracker_Name_5', | ||
| 'type': 'TrackerReference', | ||
| }, | ||
| 'version': 1, | ||
| } | ||
| ] | ||
| } | ||
| self.codebeamer_flask.responses = [ | ||
| Response(json.dumps(response_data), status=200), | ||
| ] | ||
| self._test_runner.declare_output_file( | ||
| self._data_directory / cfg.out) | ||
|
|
||
| completed_process = self._test_runner.run_tool_test() | ||
| asserter = Asserter(self, completed_process, self._test_runner) | ||
| asserter.assertExitCode(0) | ||
|
|
||
| # Verify the baselineId parameter was included in the request URL | ||
| self.assertEqual(len(self.codebeamer_flask.received_requests), 1) | ||
| request_url = self.codebeamer_flask.received_requests[0]["url"] | ||
| self.assertIn("baselineId=407126303", request_url) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.