Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Scope URIs query parameter for server hardware #436

Open
wants to merge 2 commits into
base: release/v4.8.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hpOneView/resources/servers/server_hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def get_utilization(self, id_or_uri, fields=None, filter=None, refresh=False, vi

return self._client.get_utilization(id_or_uri, fields=fields, filter=filter, refresh=refresh, view=view)

def get_all(self, start=0, count=-1, filter='', sort=''):
def get_all(self, start=0, count=-1, filter='', sort='', scope_uris=''):
"""
Gets a list of server hardware resources. Returns a list of resources based on optional sorting and filtering,
and constrained by start and count parameters.
Expand All @@ -154,7 +154,7 @@ def get_all(self, start=0, count=-1, filter='', sort=''):
Returns:
list: A list of server hardware resources.
"""
return self._client.get_all(start, count, filter=filter, sort=sort)
return self._client.get_all(start, count, filter=filter, sort=sort, scope_uris=scope_uris)

def add(self, information, timeout=-1):
"""
Expand Down
7 changes: 4 additions & 3 deletions tests/unit/resources/servers/test_server_hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,17 @@ def test_get_utilization_with_defaults(self, mock_get):
def test_get_all_called_once(self, mock_get_all):
filter = 'name=TestName'
sort = 'name:ascending'
scope_uris = '/rest/test/scopes'

self._server_hardware.get_all(2, 500, filter, sort)
self._server_hardware.get_all(2, 500, filter, sort, scope_uris)

mock_get_all.assert_called_once_with(2, 500, filter=filter, sort=sort)
mock_get_all.assert_called_once_with(2, 500, filter=filter, sort=sort, scope_uris=scope_uris)

@mock.patch.object(ResourceClient, 'get_all')
def test_get_all_called_once_with_default_values(self, mock_get_all):
self._server_hardware.get_all()

mock_get_all.assert_called_once_with(0, -1, filter='', sort='')
mock_get_all.assert_called_once_with(0, -1, filter='', sort='', scope_uris='')

@mock.patch.object(ResourceClient, 'get_by')
def test_get_by_called_once(self, mock_get_by):
Expand Down