Skip to content

Commit

Permalink
Merge pull request #78 from github-sachingg/HTTPBasicAuthProp
Browse files Browse the repository at this point in the history
Adding support of HTTPBasicAuth Property in AccountService Schema AccountService.v1_15_0
  • Loading branch information
mraineri authored Apr 19, 2024
2 parents 9577137 + 9efca73 commit 126fe1b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions redfish_protocol_validator/service_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,33 @@ def test_odata_version_header(sut: SystemUnderTest):
test_header_value(sut, header, '4.0', uri, method, response,
Assertion.RESP_HEADERS_ODATA_VERSION)

def test_www_authenticate_requirement(sut: SystemUnderTest):
"""Check for HTTPBasicAuth Property"""
response = sut.get_response('GET', sut.account_service_uri)

if (response is not None and response.ok):
data = response.json()
key = 'HTTPBasicAuth'
if key in data:
if data[key] != "Enabled":
# could be either Disabled or Unadvertised
return False
else:
return True
# Any Failure will be considered as HTTPBasicAuth not present
return True


def test_www_authenticate_header(sut: SystemUnderTest):
"""Perform tests for Assertion.RESP_HEADERS_WWW_AUTHENTICATE."""

if(False == test_www_authenticate_requirement(sut)):
msg = ('The WWW-Authenticate header is not tested because value of HTTPBasicAuth '
'is either Disabled or Unadvertised ')
sut.log(Result.NOT_TESTED, '', '', '',
Assertion.RESP_HEADERS_WWW_AUTHENTICATE, msg)
return

# a selection of URis to test
uris = [sut.sessions_uri, sut.mgr_net_proto_uri, sut.systems_uri,
sut.accounts_uri, sut.account_service_uri,
Expand Down

0 comments on commit 126fe1b

Please sign in to comment.