Initial commit
This commit is contained in:
commit
1b51716d1b
72 changed files with 8204 additions and 0 deletions
43
tests/cli/test_system.py
Normal file
43
tests/cli/test_system.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
"""Test for the system cli components"""
|
||||
# pylint: disable=redefined-outer-name, no-name-in-module, unused-import
|
||||
|
||||
import json
|
||||
import requests
|
||||
|
||||
import redfish_cli.cli
|
||||
|
||||
from ..utils import get_test_json, MockResponse, MockRedfishResponse
|
||||
|
||||
from .test_cli import secrets
|
||||
|
||||
|
||||
def test_system_details(capsys, monkeypatch, secrets):
|
||||
"""Test system-details command"""
|
||||
|
||||
def mock_get(*args, **kwargs):
|
||||
# pylint: disable=unused-argument
|
||||
mock_redfish = MockRedfishResponse()
|
||||
mock_redfish.json_dict = get_test_json("system_details.json")
|
||||
return MockResponse(content=mock_redfish.text)
|
||||
|
||||
args = redfish_cli.cli.parse_args(
|
||||
[
|
||||
"-s",
|
||||
secrets["server"],
|
||||
"-f",
|
||||
"json",
|
||||
"system",
|
||||
"-u",
|
||||
"root",
|
||||
"-p",
|
||||
"dummy",
|
||||
"show",
|
||||
]
|
||||
)
|
||||
monkeypatch.setattr(requests, "get", mock_get)
|
||||
redfish_cli.cli.system_details(args)
|
||||
captured = capsys.readouterr()
|
||||
result = json.loads(captured.out)
|
||||
assert result["@odata.id"] == "/redfish/v1/Systems/System.Embedded.1"
|
||||
|
||||
monkeypatch.setattr(requests, "get", mock_get)
|
||||
Loading…
Add table
Add a link
Reference in a new issue