remove login method#426
Conversation
WalkthroughThe changes remove explicit session management and login logic from the Corellium API client and its associated driver and tests. The Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CorelliumDriver
participant ApiClient
participant CorelliumAPI
User ->> CorelliumDriver: Instantiate with host and token
CorelliumDriver ->> ApiClient: Initialize with host and token
ApiClient ->> ApiClient: Set Authorization header with bearer token
User ->> CorelliumDriver: Make API call
CorelliumDriver ->> ApiClient: Forward API call
ApiClient ->> CorelliumAPI: Send request with Authorization header
CorelliumAPI -->> ApiClient: Respond with data
ApiClient -->> CorelliumDriver: Return response
CorelliumDriver -->> User: Return result
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (4)
⏰ Context from checks skipped due to timeout of 90000ms (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for jumpstarter-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 3
🧹 Nitpick comments (2)
packages/jumpstarter-driver-corellium/jumpstarter_driver_corellium/corellium/api.py (1)
15-19: Tighten constructor doc-stringThe doc-string ends abruptly (“containing a”). This makes auto-generated documentation look unpolished.
packages/jumpstarter-driver-corellium/jumpstarter_driver_corellium/driver.py (1)
25-26: Publicapiexposure: double-check encapsulation intentChanging from private
_apito publicapiincreases the surface area: external callers/tests can now mutate internal state freely (e.g. swap outreq.headers).
If this is intentional (to ease testing) consider:
- Annotating with a leading underscore and adding
@propertyread-only accessor, or- Documenting that the field is public and MUST NOT be reassigned.
Also applies to: 61-62
🛑 Comments failed to post (3)
packages/jumpstarter-driver-corellium/jumpstarter_driver_corellium/corellium/api.py (1)
21-24:
⚠️ Potential issueRemove dead
sessionattribute and trailing-whitespace line
self.sessionis now an unused vestige of the old login flow and can be misleading for maintainers.
Line 31 contains only whitespace and is triggering Ruff W293.- self.session = None self.req = requests.Session() self.req.headers.update({'Authorization': f'Bearer {self.token}'}) - +Also applies to: 31-31
packages/jumpstarter-driver-corellium/jumpstarter_driver_corellium/driver_test.py (2)
101-108:
⚠️ Potential issueWrong method invoked – calling
off()in power-on error test
test_driver_power_on_errorshould exercisepower.on(), notpower.off(), otherwise it’s validating the wrong path.- power.off() + power.on()📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.with pytest.raises((CorelliumApiException, ValueError)): with (patch.object(root.api, 'get_project', **mock_data.get('get_project', {'return_value': project})), patch.object(root.api, 'get_instance', **mock_data.get('get_instance', {'return_value': instance})), patch.object(root.api, 'create_instance', **mock_data.get('create_instance', {'return_value': instance}))): power.on()
187-191:
⚠️ Potential issueCopy-paste issue: patching the wrong method name
The last patch nests
get_instance_console_idtwice; the second one should targetget_instance_console_url.- patch.object(root.api, 'get_instance_console_id', - **mock_data.get('get_instance_console_url', {'return_value': 'ws://mock'}))): + patch.object(root.api, 'get_instance_console_url', + **mock_data.get('get_instance_console_url', {'return_value': 'ws://mock'}))):Without this, the mock dict key is ignored and the context manager raises
AttributeError.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.patch.object(root.api, 'get_instance_console_id', **mock_data.get('get_instance_console_id', {'return_value': 'uart7-cons'})), patch.object(root.api, 'get_instance_console_url', **mock_data.get('get_instance_console_url', {'return_value': 'ws://mock'}))): assert console.url
Signed-off-by: Leonardo Rossetti <lrossett@redhat.com>
Changes
Verification
It should work as before, just an internal API improvement.
Summary by CodeRabbit