43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
"""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)
|