Skip to content
This repository was archived by the owner on Aug 23, 2024. It is now read-only.

Commit 8d3a0e8

Browse files
committedOct 18, 2018
Added more assertions for Manager Account, reverted assertions for Manager and fixed issues with Account Service and Action Info
1 parent c4ce186 commit 8d3a0e8

4 files changed

+81
-308
lines changed
 

‎rfs_test/TEST_accountservice_schema.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ def createDummyAccount(self):
4343
'RoleId': 'Administrator'
4444
}
4545

46-
uri = relative_uris['Root Service_AccountService_Accounts']
46+
uri = None
47+
48+
try:
49+
uri = relative_uris['Root Service_AccountService_Accounts']
50+
51+
except:
52+
print('Root Service_AccountService_Accounts not in relative_uris')
4753

4854
json_payload, headers, status = self.http_POST(uri, rq_headers, rq_body, authorization)
4955

‎rfs_test/TEST_actioninfo_schema.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def Assertion_ACTI104(self,log) :
5050
except:
5151

5252
assertion_status = log.WARN
53-
log.assertion_log('line', "Resource %s, is not found." % (relative_uris['Root Service_Systems']))
53+
log.assertion_log('line', "Resource, is not found or Root Service_Systems is not found in relative_uris")
5454
return assertion_status
5555

5656
try:

‎rfs_test/TEST_manager.py

-306
This file was deleted.

‎rfs_test/TEST_manager_account.py

+73
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,81 @@ def Assertion_MANA101(self, log):
9999
log.assertion_log('line', "AccountService property is absent.")
100100
return (assertion_status)
101101

102+
103+
##################################################################################################
104+
# Description: The value of this property shall be the password for this account.
105+
# The value of this property shall be the user name for this account.
106+
# The value of this property shall be the ID of the Role resource that configured for this
107+
# account.  The service shall reject POST, PATCH, or PUT operations that provide a RoleId that
108+
# does not exist by returning HTTP 400 (Bad Request).
109+
# Name: Assertion_MANA103(self, log)
110+
##################################################################################################
111+
def Assertion_MANA103(self, log):
112+
log.AssertionID = 'MANA103'
113+
assertion_status = log.PASS
114+
log.assertion_log('BEGIN_ASSERTION', None)
115+
116+
relative_uris = self.relative_uris
117+
authorization = 'on'
118+
rq_headers = self.request_headers()
119+
# print(json.dumps(json_payload_get, sort_keys=True, indent=4)
120+
121+
try:
122+
json_payload_get, headers, status = self.http_GET(self.sut_toplevel_uris['AccountService']['url'], rq_headers, authorization)
123+
124+
try:
125+
json_payload_get_P, headers, status = self.http_GET(json_payload_get['Accounts']['@odata.id'], rq_headers, authorization)
126+
127+
try:
128+
json_payload_get, headers, status = self.http_GET(json_payload_get_P['Members'][0]['@odata.id'], rq_headers, authorization)
129+
managerRoleId = json_payload_get['RoleId']
130+
print(json.dumps(json_payload_get, sort_keys=True, indent=4))
131+
132+
# Testing if the service shall reject PATCH operation that provide a RoleId that does not exist by returning HTTP 400 (Bad Request).
133+
134+
rq_body = {'RoleId': False}
135+
json_payload_get_P, headers, status = self.http_PATCH(json_payload_get_P['Members'][0]['@odata.id'], rq_headers, rq_body, authorization)
136+
137+
if status != 400:
138+
assertion_status = log.FAIL
139+
log.assertion_log('line', "The service did not reject the PATCH operation that provided a RoleId that does not exist by returning HTTP 400 (Bad Request)" )
140+
return (assertion_status)
141+
142+
try:
143+
json_payload_get, headers, status = self.http_GET(json_payload_get['Links']['Role']['@odata.id'], rq_headers, authorization)
144+
145+
if managerRoleId == json_payload_get['Id']:
146+
assertion_status = log.PASS
147+
return (assertion_status)
148+
else:
149+
assertion_status = log.FAIL
150+
log.assertion_log('line', "The value of this property does not match the Id property of the role referenced in the Role resource referenced from Links")
151+
return (assertion_status)
152+
153+
except:
154+
assertion_status = log.WARN
155+
log.assertion_log('line', "No accounts are present.")
156+
return (assertion_status)
157+
158+
except:
159+
assertion_status = log.WARN
160+
log.assertion_log('line', "No accounts are present.")
161+
return (assertion_status)
162+
163+
except:
164+
assertion_status = log.WARN
165+
log.assertion_log('line', "Accounts property is absent.")
166+
return (assertion_status)
167+
168+
except:
169+
assertion_status = log.WARN
170+
log.assertion_log('line', "AccountService property is absent.")
171+
return (assertion_status)
172+
173+
102174
# run(self, log):
103175
# Takes sut obj and logger obj
104176
###################################################################################################
105177
def run(self, log):
106178
assertion_status = Assertion_MANA101(self,log)
179+
assertion_status = Assertion_MANA103(self,log)

0 commit comments

Comments
 (0)
This repository has been archived.