Skip to content

Commit

Permalink
[WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
matejart committed Sep 4, 2019
1 parent 1537347 commit ce7434c
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion tests/test_redfish.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# coding: utf-8
# Unit tests for the Redfish API
import pytest
from unittest import mock, TestCase

from redfish_client.root import Root
Expand Down Expand Up @@ -262,7 +263,8 @@ def test_server_stats_inventory(self, mock_connector):
physical_server = mock.Mock()
physical_server.ems_ref = "/redfish/v1/Systems/System-1-2-1-1"
requested_stats = ["cores_capacity", "memory_capacity",
# "num_network_devices", "num_storage_devices"
"num_network_devices",
# "num_storage_devices"
]
requested_inventory = ["power_state"]
self.assertEqual(rf.server_stats(physical_server, requested_stats),
Expand Down Expand Up @@ -439,6 +441,33 @@ def test_server_name_no_sn(self, mock_connector):
rf_server = rf.get_server("/redfish/v1/Systems/System-1-2-1-1")
self.assertEqual(rf_server.name, "Dell Inc. System")

@pytest.mark.parametrize("tuple", [
(0, []),
(1, [
{ "@odata.id": "/redfish/v1/Systems/1/NetworkInterfaces/1" }
]
),
(4, [
{ "@odata.id": "/redfish/v1/Systems/1/NetworkInterfaces/1" },
{ "@odata.id": "/redfish/v1/Systems/1/NetworkInterfaces/2" },
{ "@odata.id": "/redfish/v1/Systems/1/NetworkInterfaces/3" },
{ "@odata.id": "/redfish/v1/Systems/1/NetworkInterfaces/4" }
]
),
])
def test_num_network_devices(self, tuple, mock_connector):
rf = self.mock_redfish_system(mock_connector, data={
"/redfish/v1/Systems/1": {
"@odata.id": "/redfish/v1/Systems/1",
"Id": "1",
"Manufacturer": "Dell Inc.",
"NetworkInterfaces": netinfs,
"Name": "System",
}
})
rf_server = rf.get_server("/redfish/v1/Systems/1")
self.assertEqual(rf_server.num_network_devices, num_netinfs)


@mock.patch("redfish_client.Connector")
class TestRedfishChassis(RedfishTestCase):
Expand Down

0 comments on commit ce7434c

Please sign in to comment.