assert default bmc provider#514
Conversation
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughThis pull request adds a single test function to verify that the Foreman proxy correctly reports the BMC default provider setting. The test calls the proxy Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/foreman_proxy_test.py (1)
70-72: ⚡ Quick winAssert
bmc/settingspresence before dereferencing for clearer failures.Right now a schema regression produces
KeyError/AttributeErrorinstead of a precise assertion failure about missing BMC data.Proposed patch
`@pytest.mark.feature`('bmc') def test_bmc_default_provider(server, certificates, server_fqdn): features = get_proxy_v2_features(server, certificates, server_fqdn) - settings = features['bmc'].get('settings', {}) + assert 'bmc' in features + settings = features['bmc'].get('settings') + assert isinstance(settings, dict) assert settings.get('bmc_default_provider') == 'ipmitool'🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/foreman_proxy_test.py` around lines 70 - 72, The test dereferences features['bmc'] and its 'settings' without asserting their presence, which raises KeyError/AttributeError on schema regressions; before checking 'bmc_default_provider', add explicit assertions that features contains 'bmc' and that features['bmc'] has a 'settings' dict (or non-None), then retrieve settings = features['bmc'].get('settings', {}) and assert settings.get('bmc_default_provider') == 'ipmitool' so failures show clear messages about missing 'bmc' or 'settings' rather than low-level exceptions; reference get_proxy_v2_features, features, settings, 'bmc', and 'bmc_default_provider' when making the changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/foreman_proxy_test.py`:
- Around line 70-72: The test dereferences features['bmc'] and its 'settings'
without asserting their presence, which raises KeyError/AttributeError on schema
regressions; before checking 'bmc_default_provider', add explicit assertions
that features contains 'bmc' and that features['bmc'] has a 'settings' dict (or
non-None), then retrieve settings = features['bmc'].get('settings', {}) and
assert settings.get('bmc_default_provider') == 'ipmitool' so failures show clear
messages about missing 'bmc' or 'settings' rather than low-level exceptions;
reference get_proxy_v2_features, features, settings, 'bmc', and
'bmc_default_provider' when making the changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f3d5dd26-90b3-4cf2-900b-1c42992db086
📒 Files selected for processing (1)
tests/foreman_proxy_test.py
Why are you introducing these changes? (Problem description, related links)
Extend BMC test to assert default bmc provider using /v2/features api
What are the changes introduced in this pull request?
How to test this pull request
Steps to reproduce:
Checklist