|
72 | 72 | "pol_hr_post = utils.read_policy_xml('hr_post.xml', sample_name = sample_folder)\n", |
73 | 73 | "\n", |
74 | 74 | "# Employees (HR)\n", |
75 | | - "hremployees_api_path = f'/{api_prefix}employees'\n", |
76 | | - "hremployees_get = GET_APIOperation('Gets the employees', pol_hr_get,)\n", |
77 | | - "hremployees_post = POST_APIOperation('Creates a new employee', pol_hr_post)\n", |
78 | | - "hremployees = API(f'{api_prefix}Employees', 'Employees Pro', hremployees_api_path, 'This is a Human Resources API for employee information', \n", |
79 | | - " operations = [hremployees_get, hremployees_post], tags = tags, productNames = [hr_product_name], subscriptionRequired = False)\n", |
| 75 | + "hr_employees_api_path = f'/{api_prefix}employees'\n", |
| 76 | + "hr_employees_get = GET_APIOperation('Gets the employees', pol_hr_get,)\n", |
| 77 | + "hr_employees_post = POST_APIOperation('Creates a new employee', pol_hr_post)\n", |
| 78 | + "hr_employees = API(f'{api_prefix}Employees', 'Employees Pro', hr_employees_api_path, 'This is a Human Resources API for employee information', \n", |
| 79 | + " operations = [hr_employees_get, hr_employees_post], tags = tags, productNames = [hr_product_name], subscriptionRequired = False)\n", |
80 | 80 | "\n", |
81 | 81 | "# Benefits (HR)\n", |
82 | | - "hrbenefits_api_path = f'/{api_prefix}benefits'\n", |
83 | | - "hrbenefits_get = GET_APIOperation('Gets employee benefits', pol_hr_get)\n", |
84 | | - "hrbenefits_post = POST_APIOperation('Creates employee benefits', pol_hr_post)\n", |
85 | | - "hrbenefits = API(f'{api_prefix}Benefits', 'Benefits Pro', hrbenefits_api_path, 'This is a Human Resources API for employee benefits',\n", |
86 | | - " operations = [hrbenefits_get, hrbenefits_post], tags = tags, productNames = [hr_product_name], subscriptionRequired = False)\n", |
| 82 | + "hr_benefits_api_path = f'/{api_prefix}benefits'\n", |
| 83 | + "hr_benefits_get = GET_APIOperation('Gets employee benefits', pol_hr_get)\n", |
| 84 | + "hr_benefits_post = POST_APIOperation('Creates employee benefits', pol_hr_post)\n", |
| 85 | + "hr_benefits = API(f'{api_prefix}Benefits', 'Benefits Pro', hr_benefits_api_path, 'This is a Human Resources API for employee benefits',\n", |
| 86 | + " operations = [hr_benefits_get, hr_benefits_post], tags = tags, productNames = [hr_product_name], subscriptionRequired = False)\n", |
87 | 87 | "\n", |
88 | 88 | "# APIs Array\n", |
89 | | - "apis: List[API] = [hremployees, hrbenefits]\n", |
| 89 | + "apis: List[API] = [hr_employees, hr_benefits]\n", |
90 | 90 | "\n", |
91 | 91 | "utils.print_ok('Notebook initialized')" |
92 | 92 | ] |
|
165 | 165 | "reqsApimAdmin.headers['Authorization'] = f'Bearer {encoded_jwt_token_hr_admin}'\n", |
166 | 166 | "\n", |
167 | 167 | "# Call APIM\n", |
168 | | - "output = reqsApimAdmin.singleGet(hremployees_api_path, msg = 'Calling GET Employees API via API Management Gateway URL. Expect 200.')\n", |
| 168 | + "output = reqsApimAdmin.singleGet(hr_employees_api_path, msg = 'Calling GET Employees API via API Management Gateway URL. Expect 200.')\n", |
169 | 169 | "tests.verify(output, 'Successful GET')\n", |
170 | 170 | "\n", |
171 | | - "output = reqsApimAdmin.singlePost(hremployees_api_path, msg = 'Calling POST Employees API via API Management Gateway URL. Expect 200.')\n", |
| 171 | + "output = reqsApimAdmin.singlePost(hr_employees_api_path, msg = 'Calling POST Employees API via API Management Gateway URL. Expect 200.')\n", |
172 | 172 | "tests.verify(output, 'Successful POST')\n", |
173 | 173 | "\n", |
174 | | - "output = reqsApimAdmin.singleGet(hrbenefits_api_path, msg = 'Calling GET Benefits API via API Management Gateway URL. Expect 200.')\n", |
| 174 | + "output = reqsApimAdmin.singleGet(hr_benefits_api_path, msg = 'Calling GET Benefits API via API Management Gateway URL. Expect 200.')\n", |
175 | 175 | "tests.verify(output, 'Successful GET')\n", |
176 | 176 | "\n", |
177 | | - "output = reqsApimAdmin.singlePost(hrbenefits_api_path, msg = 'Calling POST Benefits API via API Management Gateway URL. Expect 200.')\n", |
| 177 | + "output = reqsApimAdmin.singlePost(hr_benefits_api_path, msg = 'Calling POST Benefits API via API Management Gateway URL. Expect 200.')\n", |
178 | 178 | "tests.verify(output, 'Successful POST')\n", |
179 | 179 | "\n", |
180 | 180 | "# 2) HR Associate\n", |
|
187 | 187 | "reqsApimAssociate.headers['Authorization'] = f'Bearer {encoded_jwt_token_hr_associate}'\n", |
188 | 188 | "\n", |
189 | 189 | "# Call APIM\n", |
190 | | - "output = reqsApimAssociate.singleGet(hremployees_api_path, msg = 'Calling GET Employees API via API Management Gateway URL. Expect 200.')\n", |
| 190 | + "output = reqsApimAssociate.singleGet(hr_employees_api_path, msg = 'Calling GET Employees API via API Management Gateway URL. Expect 200.')\n", |
191 | 191 | "tests.verify(output, 'Successful GET')\n", |
192 | 192 | "\n", |
193 | | - "output = reqsApimAssociate.singlePost(hremployees_api_path, msg = 'Calling POST Employees API via API Management Gateway URL. Expect 403.')\n", |
| 193 | + "output = reqsApimAssociate.singlePost(hr_employees_api_path, msg = 'Calling POST Employees API via API Management Gateway URL. Expect 403.')\n", |
194 | 194 | "tests.verify(output, 'Access denied - no matching roles found')\n", |
195 | 195 | "\n", |
196 | | - "output = reqsApimAssociate.singleGet(hrbenefits_api_path, msg = 'Calling GET Benefits API via API Management Gateway URL. Expect 200.')\n", |
| 196 | + "output = reqsApimAssociate.singleGet(hr_benefits_api_path, msg = 'Calling GET Benefits API via API Management Gateway URL. Expect 200.')\n", |
197 | 197 | "tests.verify(output, 'Successful GET')\n", |
198 | 198 | "\n", |
199 | | - "output = reqsApimAssociate.singlePost(hrbenefits_api_path, msg = 'Calling POST Benefits API via API Management Gateway URL. Expect 403.')\n", |
| 199 | + "output = reqsApimAssociate.singlePost(hr_benefits_api_path, msg = 'Calling POST Benefits API via API Management Gateway URL. Expect 403.')\n", |
200 | 200 | "tests.verify(output, 'Access denied - no matching roles found')\n", |
201 | 201 | "\n", |
202 | 202 | "tests.print_summary()\n", |
|
0 commit comments