How to use is_equal_to_ignoring_case method in assertpy

Best Python code snippet using assertpy_python

test_error_cases.py

Source:test_error_cases.py Github

copy

Full Screen

...55 56 # Then57 assert_that(expected_status_code).is_equal_to(response.status_code)58 # assert_that(actual_response['message_id']).is_not_empty()59 assert_that(expected_response['resourceType']).is_equal_to_ignoring_case(actual_response['resourceType'])60 assert_that(expected_response['issue'][0]['code']).is_equal_to_ignoring_case(61 actual_response['issue'][0]['code'])62 assert_that(expected_response['issue'][0]['details']['coding'][0]['code']).is_equal_to_ignoring_case(63 actual_response['issue'][0]['details']['coding'][0]['code'])64 assert_that(expected_response['issue'][0]['details']['coding'][0]['display']).is_equal_to_ignoring_case(65 actual_response['issue'][0]['details']['coding'][0]['display'])66 assert_that(expected_response['issue'][0]['diagnostics']).is_equal_to_ignoring_case(67 actual_response['issue'][0]['diagnostics'])68 @pytest.mark.errors69 @pytest.mark.integration70 @pytest.mark.usefixtures('get_token_internal_dev')71 def test_missing_x_request_id_header(self):72 # Given73 expected_status_code = 40074 expected_response = {75 'resourceType': 'OperationOutcome',76 'issue':77 [78 {79 'severity': 'error',80 'code': 'value',81 'details':82 {83 'coding':84 [85 {86 'system': 'https://fhir.nhs.uk/R4/CodeSystem/Spine-ErrorOrWarningCode',87 'version': '1',88 'code': 'BAD_REQUEST',89 'display': 'Bad request'90 }91 ]92 },93 'diagnostics': 'x-request-id is missing or invalid'94 }95 ]96 }97 # When98 response = requests.get(99 url=config.REASONABLE_ADJUSTMENTS_CONSENT,100 params={101 'patient': 'test',102 'category': 'test',103 'status': 'test',104 },105 headers={106 'Authorization': f'Bearer {self.token}',107 'nhsd-session-urid': config.TEST_NHSD_SESSION_URID,108 }109 )110 actual_response = json.loads(response.text)111 # Then112 assert_that(expected_status_code).is_equal_to(response.status_code)113 # assert_that(actual_response['message_id']).is_not_empty()114 assert_that(expected_response['resourceType']).is_equal_to_ignoring_case(actual_response['resourceType'])115 assert_that(expected_response['issue'][0]['code']).is_equal_to_ignoring_case(116 actual_response['issue'][0]['code'])117 assert_that(expected_response['issue'][0]['details']['coding'][0]['code']).is_equal_to_ignoring_case(118 actual_response['issue'][0]['details']['coding'][0]['code'])119 assert_that(expected_response['issue'][0]['details']['coding'][0]['display']).is_equal_to_ignoring_case(120 actual_response['issue'][0]['details']['coding'][0]['display'])121 assert_that(expected_response['issue'][0]['diagnostics']).is_equal_to_ignoring_case(122 actual_response['issue'][0]['diagnostics'])123 @pytest.mark.errors124 @pytest.mark.integration125 @pytest.mark.usefixtures('get_token_internal_dev')126 def test_invalid_x_request_id_header(self):127 # Given128 expected_status_code = 400129 expected_response = {130 'resourceType': 'OperationOutcome',131 'issue':132 [133 {134 'severity': 'error',135 'code': 'value',136 'details':137 {138 'coding':139 [140 {141 'system': 'https://fhir.nhs.uk/R4/CodeSystem/Spine-ErrorOrWarningCode',142 'version': '1',143 'code': 'BAD_REQUEST',144 'display': 'Bad request'145 }146 ]147 },148 'diagnostics': 'x-request-id is missing or invalid'149 }150 ]151 }152 # When153 response = requests.get(154 url=config.REASONABLE_ADJUSTMENTS_CONSENT,155 params={156 'patient': 'test',157 'category': 'test',158 'status': 'test',159 },160 headers={161 'Authorization': f'Bearer {self.token}',162 'nhsd-session-urid': config.TEST_NHSD_SESSION_URID,163 'x-request-id': 'not-GUID'164 }165 )166 actual_response = json.loads(response.text)167 # Then168 assert_that(expected_status_code).is_equal_to(response.status_code)169 # assert_that(actual_response['message_id']).is_not_empty()170 assert_that(expected_response['resourceType']).is_equal_to_ignoring_case(actual_response['resourceType'])171 assert_that(expected_response['issue'][0]['code']).is_equal_to_ignoring_case(172 actual_response['issue'][0]['code'])173 assert_that(expected_response['issue'][0]['details']['coding'][0]['code']).is_equal_to_ignoring_case(174 actual_response['issue'][0]['details']['coding'][0]['code'])175 assert_that(expected_response['issue'][0]['details']['coding'][0]['display']).is_equal_to_ignoring_case(176 actual_response['issue'][0]['details']['coding'][0]['display'])177 assert_that(expected_response['issue'][0]['diagnostics']).is_equal_to_ignoring_case(178 actual_response['issue'][0]['diagnostics'])179 @pytest.mark.errors180 @pytest.mark.integration181 @pytest.mark.usefixtures('get_token_internal_dev')182 @pytest.mark.parametrize('nhsd_session_urid',183 [184 # Empty string185 (''),186 # Invalid nhsd-session-urid187 ('This is not a valid nhsd-session-urid'),188 # Symbols189 ('#£$?!&%*.;@~_-'),190 # Numbers191 ('0123456789')192 ]193 )194 195 def test_missing_nhsd_session_urid_header(self, nhsd_session_urid):196 # Given197 expected_status_code = 400198 expected_response = {199 'resourceType': 'OperationOutcome',200 'issue':201 [202 {203 'severity': 'error', 204 'code': 'value', 205 'details':206 {207 'coding':208 [209 {210 'system': 'https://fhir.nhs.uk/R4/CodeSystem/Spine-ErrorOrWarningCode',211 'version': '1',212 'code': 'BAD_REQUEST',213 'display': 'Bad Request'214 }215 ]216 },217 'diagnostics': 'nhsd-session-urid is invalid'218 }219 ]220 }221 # When222 response = requests.get(223 url=config.REASONABLE_ADJUSTMENTS_CONSENT,224 params={225 'patient': 'test',226 'category': 'test',227 'status': 'test',228 },229 headers={230 'Authorization': f'Bearer {self.token}',231 'x-request-id': str(uuid.uuid4()),232 'nhsd-session-urid': nhsd_session_urid,233 }234 )235 actual_response = json.loads(response.text)236 237 # Then238 assert_that(expected_status_code).is_equal_to(response.status_code)239 assert_that(expected_response['resourceType']).is_equal_to_ignoring_case(actual_response['resourceType'])240 assert_that(expected_response['issue'][0]['code']).is_equal_to_ignoring_case(241 actual_response['issue'][0]['code'])242 assert_that(expected_response['issue'][0]['details']['coding'][0]['code']).is_equal_to_ignoring_case(243 actual_response['issue'][0]['details']['coding'][0]['code'])244 assert_that(expected_response['issue'][0]['details']['coding'][0]['display']).is_equal_to_ignoring_case(245 actual_response['issue'][0]['details']['coding'][0]['display'])246 assert_that(expected_response['issue'][0]['diagnostics']).is_equal_to_ignoring_case(247 actual_response['issue'][0]['diagnostics'])248 @pytest.mark.errors249 @pytest.mark.integration250 @pytest.mark.usefixtures('get_token_internal_dev')251 def test_invalid_content_type(self):252 # Given253 expected_status_code = 400254 expected_response = {255 'resourceType': 'OperationOutcome', 256 'issue': 257 [258 {259 'severity': 'error', 260 'code': 'value', 261 'details': 262 {263 'coding': 264 [265 {266 'system': 'https://fhir.nhs.uk/R4/CodeSystem/Spine-ErrorOrWarningCode', 267 'version': '1', 268 'code': 'BAD_REQUEST', 269 'display': 'Bad request'270 }271 ]272 }, 273 'diagnostics': 'content-type must be set to application/fhir+json'274 }275 ]276 }277 # When278 response = requests.post(279 url=config.REASONABLE_ADJUSTMENTS_CONSENT,280 headers={281 'Authorization': f'Bearer {self.token}',282 'x-request-id': str(uuid.uuid4()),283 'nhsd-session-urid': config.TEST_NHSD_SESSION_URID,284 'content-type': 'application/json'285 },286 data={287 'message': 'test'288 }289 )290 actual_response = json.loads(response.text)291 292 # Then293 assert_that(expected_status_code).is_equal_to(response.status_code)294 # assert_that(actual_response['message_id']).is_not_empty()295 assert_that(expected_response['resourceType']).is_equal_to_ignoring_case(actual_response['resourceType'])296 assert_that(expected_response['issue'][0]['code']).is_equal_to_ignoring_case(297 actual_response['issue'][0]['code'])298 assert_that(expected_response['issue'][0]['details']['coding'][0]['code']).is_equal_to_ignoring_case(299 actual_response['issue'][0]['details']['coding'][0]['code'])300 assert_that(expected_response['issue'][0]['details']['coding'][0]['display']).is_equal_to_ignoring_case(301 actual_response['issue'][0]['details']['coding'][0]['display'])302 assert_that(expected_response['issue'][0]['diagnostics']).is_equal_to_ignoring_case(303 actual_response['issue'][0]['diagnostics'])304 @pytest.mark.errors305 @pytest.mark.integration306 @pytest.mark.usefixtures('get_token_internal_dev')307 def test_invalid_payload(self):308 # Given309 expected_status_code = 400310 expected_response = {311 'resourceType': 'OperationOutcome', 312 'issue': 313 [314 {315 'severity': 'error', 316 'code': 'value', 317 'details': 318 {319 'coding': 320 [321 {322 'system': 'https://fhir.nhs.uk/R4/CodeSystem/Spine-ErrorOrWarningCode', 323 'version': '1', 324 'code': 'BAD_REQUEST', 325 'display': 'Bad request'326 }327 ]328 }, 329 'diagnostics': 'requires payload'330 }331 ]332 }333 # When334 response = requests.post(335 url=config.REASONABLE_ADJUSTMENTS_CONSENT,336 headers={337 'Authorization': f'Bearer {self.token}',338 'x-request-id': str(uuid.uuid4()),339 'nhsd-session-urid': config.TEST_NHSD_SESSION_URID,340 'content-type': 'application/fhir+json'341 }342 )343 actual_response = json.loads(response.text)344 345 # Then346 assert_that(expected_status_code).is_equal_to(response.status_code)347 # assert_that(actual_response['message_id']).is_not_empty()348 assert_that(expected_response['resourceType']).is_equal_to_ignoring_case(actual_response['resourceType'])349 assert_that(expected_response['issue'][0]['code']).is_equal_to_ignoring_case(350 actual_response['issue'][0]['code'])351 assert_that(expected_response['issue'][0]['details']['coding'][0]['code']).is_equal_to_ignoring_case(352 actual_response['issue'][0]['details']['coding'][0]['code'])353 assert_that(expected_response['issue'][0]['details']['coding'][0]['display']).is_equal_to_ignoring_case(354 actual_response['issue'][0]['details']['coding'][0]['display'])355 assert_that(expected_response['issue'][0]['diagnostics']).is_equal_to_ignoring_case(356 actual_response['issue'][0]['diagnostics'])357 @pytest.mark.errors358 @pytest.mark.integration359 @pytest.mark.usefixtures('get_token_internal_dev')360 @pytest.mark.parametrize('url,params', [(config.REASONABLE_ADJUSTMENTS_CONSENT, {'patient': 'test', 'category': 'test'}),361 (config.REASONABLE_ADJUSTMENTS_LIST, {'patient': 'test', 'code': 'test'}),362 (config.REASONABLE_ADJUSTMENTS_FLAG, {'patient': 'test', 'category': 'test'})])363 def test_get_invalid_query_params(self, url, params):364 # Given365 expected_status_code = 404366 expected_response = {367 'resourceType': 'OperationOutcome', 368 'issue': 369 [370 {371 'severity': 'error', 372 'code': 'value', 373 'details': 374 {375 'coding': 376 [377 {378 'system': 'https://fhir.nhs.uk/R4/CodeSystem/Spine-ErrorOrWarningCode', 379 'version': '1', 380 'code': 'BAD_REQUEST', 381 'display': 'Bad request'382 }383 ]384 }, 385 'diagnostics': 'required query parameters are missing or have empty values'386 }387 ]388 }389 # When390 response = requests.get(391 url,392 params,393 headers={394 'Authorization': f'Bearer {self.token}',395 'nhsd-session-urid': config.TEST_NHSD_SESSION_URID,396 'x-request-id': str(uuid.uuid4()),397 }398 )399 actual_response = json.loads(response.text)400 # Then401 assert_that(expected_status_code).is_equal_to(response.status_code)402 # assert_that(actual_response['message_id']).is_not_empty()403 assert_that(expected_response['resourceType']).is_equal_to_ignoring_case(actual_response['resourceType'])404 assert_that(expected_response['issue'][0]['code']).is_equal_to_ignoring_case(405 actual_response['issue'][0]['code'])406 assert_that(expected_response['issue'][0]['details']['coding'][0]['code']).is_equal_to_ignoring_case(407 actual_response['issue'][0]['details']['coding'][0]['code'])408 assert_that(expected_response['issue'][0]['details']['coding'][0]['display']).is_equal_to_ignoring_case(409 actual_response['issue'][0]['details']['coding'][0]['display'])410 assert_that(expected_response['issue'][0]['diagnostics']).is_equal_to_ignoring_case(411 actual_response['issue'][0]['diagnostics'])412 @pytest.mark.errors413 @pytest.mark.integration414 @pytest.mark.usefixtures('get_token_internal_dev')415 def test_flag_invalid_header_put(self):416 # Given417 expected_status_code = 400418 expected_response = {419 'resourceType': 'OperationOutcome', 420 'issue': 421 [422 {423 'severity': 'error', 424 'code': 'value', 425 'details': 426 {427 'coding': 428 [429 {430 'system': 'https://fhir.nhs.uk/R4/CodeSystem/Spine-ErrorOrWarningCode', 431 'version': '1', 432 'code': 'MISSING_OR_INVALID_HEADER', 433 'display': 'There is a required header missing or invalid'434 }435 ]436 }, 437 'diagnostics': 'if-match is missing or invalid'438 }439 ]440 }441 # When442 response = requests.put(443 url=config.REASONABLE_ADJUSTMENTS_FLAG + '/1',444 headers={445 'Authorization': f'Bearer {self.token}',446 'nhsd-session-urid': config.TEST_NHSD_SESSION_URID,447 'x-request-id': str(uuid.uuid4()),448 },449 data={450 'message': 'test'451 }452 )453 actual_response = json.loads(response.text)454 # Then455 assert_that(expected_status_code).is_equal_to(response.status_code)456 # assert_that(actual_response['message_id']).is_not_empty()457 assert_that(expected_response['resourceType']).is_equal_to_ignoring_case(actual_response['resourceType'])458 assert_that(expected_response['issue'][0]['code']).is_equal_to_ignoring_case(459 actual_response['issue'][0]['code'])460 assert_that(expected_response['issue'][0]['details']['coding'][0]['code']).is_equal_to_ignoring_case(461 actual_response['issue'][0]['details']['coding'][0]['code'])462 assert_that(expected_response['issue'][0]['details']['coding'][0]['display']).is_equal_to_ignoring_case(463 actual_response['issue'][0]['details']['coding'][0]['display'])464 assert_that(expected_response['issue'][0]['diagnostics']).is_equal_to_ignoring_case(465 actual_response['issue'][0]['diagnostics'])466 @pytest.mark.errors467 @pytest.mark.integration468 @pytest.mark.usefixtures('get_token_internal_dev')469 def test_list_invalid_query_params(self):470 # Given471 expected_status_code = 404472 expected_response = {473 'resourceType': 'OperationOutcome', 474 'issue': 475 [476 {477 'severity': 'invalid', 478 'code': 'value', 479 'details': 480 {481 'coding': 482 [483 {484 'system': 'https://fhir.nhs.uk/R4/CodeSystem/Spine-ErrorOrWarningCode', 485 'version': '1', 486 'code': 'BAD_REQUEST', 487 'display': 'Bad request'488 }489 ]490 }, 491 'diagnostics': 'required query parameters are missing or have empty values'492 }493 ]494 }495 # When496 response = requests.get(497 url=config.REASONABLE_ADJUSTMENTS_LIST,498 params={499 'patient': 'test',500 'code': '',501 'status': 'test',502 },503 headers={504 'Authorization': f'Bearer {self.token}',505 'nhsd-session-urid': config.TEST_NHSD_SESSION_URID,506 'x-request-id': str(uuid.uuid4()),507 }508 )509 actual_response = json.loads(response.text)510 # Then511 assert_that(expected_status_code).is_equal_to(response.status_code)512 # assert_that(actual_response['message_id']).is_not_empty()513 assert_that(expected_response['resourceType']).is_equal_to_ignoring_case(actual_response['resourceType'])514 assert_that(expected_response['issue'][0]['code']).is_equal_to_ignoring_case(515 actual_response['issue'][0]['code'])516 assert_that(expected_response['issue'][0]['details']['coding'][0]['code']).is_equal_to_ignoring_case(517 actual_response['issue'][0]['details']['coding'][0]['code'])518 assert_that(expected_response['issue'][0]['details']['coding'][0]['display']).is_equal_to_ignoring_case(519 actual_response['issue'][0]['details']['coding'][0]['display'])520 assert_that(expected_response['issue'][0]['diagnostics']).is_equal_to_ignoring_case(521 actual_response['issue'][0]['diagnostics'])522 @pytest.mark.errors523 @pytest.mark.integration524 @pytest.mark.usefixtures('get_token_internal_dev')525 def test_list_invalid_header_put(self):526 # Given527 expected_status_code = 400528 expected_response = {529 'resourceType': 'OperationOutcome', 530 'issue': 531 [532 {533 'severity': 'error', 534 'code': 'value', 535 'details': 536 {537 'coding': 538 [539 {540 'system': 'https://fhir.nhs.uk/R4/CodeSystem/Spine-ErrorOrWarningCode', 541 'version': '1', 542 'code': 'MISSING_OR_INVALID_HEADER', 543 'display': 'There is a required header missing or invalid'544 }545 ]546 }, 547 'diagnostics': 'if-match is missing or invalid'548 }549 ]550 }551 # When552 response = requests.put(553 url=config.REASONABLE_ADJUSTMENTS_LIST + '/1',554 headers={555 'Authorization': f'Bearer {self.token}',556 'nhsd-session-urid': config.TEST_NHSD_SESSION_URID,557 'x-request-id': 'test',558 'if-match': ''559 },560 data={561 'message': 'test'562 }563 )564 actual_response = json.loads(response.text)565 # Then566 assert_that(expected_status_code).is_equal_to(response.status_code)567 # assert_that(actual_response['message_id']).is_not_empty()568 assert_that(expected_response['resourceType']).is_equal_to_ignoring_case(actual_response['resourceType'])569 assert_that(expected_response['issue'][0]['code']).is_equal_to_ignoring_case(570 actual_response['issue'][0]['code'])571 assert_that(expected_response['issue'][0]['details']['coding'][0]['code']).is_equal_to_ignoring_case(572 actual_response['issue'][0]['details']['coding'][0]['code'])573 assert_that(expected_response['issue'][0]['details']['coding'][0]['display']).is_equal_to_ignoring_case(574 actual_response['issue'][0]['details']['coding'][0]['display'])575 assert_that(expected_response['issue'][0]['diagnostics']).is_equal_to_ignoring_case(576 actual_response['issue'][0]['diagnostics'])577 @pytest.mark.errors578 @pytest.mark.integration579 @pytest.mark.usefixtures('get_token_internal_dev')580 def test_removerarecord_invalid_header_post(self):581 # Given582 expected_status_code = 400583 expected_response = {584 'resourceType': 'OperationOutcome', 585 'issue': 586 [587 {588 'severity': 'error', 589 'code': 'value', 590 'details': 591 {592 'coding': 593 [594 {595 'system': 'https://fhir.nhs.uk/R4/CodeSystem/Spine-ErrorOrWarningCode', 596 'version': '1', 597 'code': 'MISSING_OR_INVALID_HEADER', 598 'display': 'There is a required header missing or invalid'599 }600 ]601 }, 602 'diagnostics': 'if-match is missing or invalid'603 }604 ]605 }606 # When607 response = requests.post(608 url=config.REASONABLE_ADJUSTMENTS_REMOVE_RA_RECORD,609 headers={610 'Authorization': f'Bearer {self.token}',611 'nhsd-session-urid': config.TEST_NHSD_SESSION_URID,612 'x-request-id': str(uuid.uuid4()),613 'content-type': 'application/fhir+json',614 'If-Match': ''615 },616 data={617 'message': 'test'618 }619 )620 actual_response = json.loads(response.text)621 # Then622 assert_that(expected_status_code).is_equal_to(response.status_code)623 # assert_that(actual_response['message_id']).is_not_empty()624 assert_that(expected_response['resourceType']).is_equal_to_ignoring_case(actual_response['resourceType'])625 assert_that(expected_response['issue'][0]['code']).is_equal_to_ignoring_case(626 actual_response['issue'][0]['code'])627 assert_that(expected_response['issue'][0]['details']['coding'][0]['code']).is_equal_to_ignoring_case(628 actual_response['issue'][0]['details']['coding'][0]['code'])629 assert_that(expected_response['issue'][0]['details']['coding'][0]['display']).is_equal_to_ignoring_case(630 actual_response['issue'][0]['details']['coding'][0]['display'])631 assert_that(expected_response['issue'][0]['diagnostics']).is_equal_to_ignoring_case(632 actual_response['issue'][0]['diagnostics'])633 @pytest.mark.ods634 @pytest.mark.errors635 @pytest.mark.integration636 @pytest.mark.usefixtures('get_token_missing_ods')637 def test_missing_ods(self):638 # Given639 expected_status_code = 500640 expected_response = {641 'resourceType': 'OperationOutcome', 642 'issue': 643 [644 {645 'severity': 'error', 646 'code': 'value', 647 'details': 648 {649 'coding': 650 [651 {652 'system': 'https://fhir.nhs.uk/R4/CodeSystem/Spine-ErrorOrWarningCode', 653 'version': '1', 654 'code': 'INTERNAL_SERVER_ERROR', 655 'display': 'Unexpected internal server error'656 }657 ]658 }, 659 'diagnostics': 'An internal server error occurred. Missing ODS. Contact us for assistance diagnosing this issue: https://digital.nhs.uk/developer/help-and-support quoting Message ID'660 }661 ]662 }663 # When664 response = Utils.send_request(self)665 actual_response = json.loads(response.text)666 667 # Then668 assert_that(expected_status_code).is_equal_to(response.status_code)669 # assert_that(actual_response['message_id']).is_not_empty()670 assert_that(expected_response['resourceType']).is_equal_to_ignoring_case(actual_response['resourceType'])671 assert_that(expected_response['issue'][0]['code']).is_equal_to_ignoring_case(672 actual_response['issue'][0]['code'])673 assert_that(expected_response['issue'][0]['details']['coding'][0]['code']).is_equal_to_ignoring_case(674 actual_response['issue'][0]['details']['coding'][0]['code'])675 assert_that(expected_response['issue'][0]['details']['coding'][0]['display']).is_equal_to_ignoring_case(676 actual_response['issue'][0]['details']['coding'][0]['display'])677 assert_that(expected_response['issue'][0]['diagnostics']).is_equal_to_ignoring_case(678 actual_response['issue'][0]['diagnostics'])679 @pytest.mark.asid680 @pytest.mark.errors681 @pytest.mark.integration682 @pytest.mark.usefixtures('get_token_missing_asid')683 def test_missing_asid(self):684 # Given685 expected_status_code = 500686 expected_response = {687 'resourceType': 'OperationOutcome', 688 'issue': 689 [690 {691 'severity': 'error', 692 'code': 'value', 693 'details': 694 {695 'coding': 696 [697 {698 'system': 'https://fhir.nhs.uk/R4/CodeSystem/Spine-ErrorOrWarningCode', 699 'version': '1', 700 'code': 'INTERNAL_SERVER_ERROR', 701 'display': 'Unexpected internal server error'702 }703 ]704 }, 705 'diagnostics': 'An internal server error occurred. Missing ASID. Contact us for assistance diagnosing this issue: https://digital.nhs.uk/developer/help-and-support quoting Message ID'706 }707 ]708 }709 # When710 response = Utils.send_request(self)711 actual_response = json.loads(response.text)712 713 # Then714 assert_that(expected_status_code).is_equal_to(response.status_code)715 # assert_that(actual_response['message_id']).is_not_empty()716 assert_that(expected_response['resourceType']).is_equal_to_ignoring_case(actual_response['resourceType'])717 assert_that(expected_response['issue'][0]['code']).is_equal_to_ignoring_case(718 actual_response['issue'][0]['code'])719 assert_that(expected_response['issue'][0]['details']['coding'][0]['code']).is_equal_to_ignoring_case(720 actual_response['issue'][0]['details']['coding'][0]['code'])721 assert_that(expected_response['issue'][0]['details']['coding'][0]['display']).is_equal_to_ignoring_case(722 actual_response['issue'][0]['details']['coding'][0]['display'])723 assert_that(expected_response['issue'][0]['diagnostics']).is_equal_to_ignoring_case(724 actual_response['issue'][0]['diagnostics'])725 @pytest.mark.errors726 @pytest.mark.integration727 def test_invalid_url(self):728 # Given729 expected_status_code = 404730 expected_response = {731 'resourceType': 'OperationOutcome', 732 'issue': 733 [734 {735 'severity': 'error', 736 'code': 'not-found', 737 'details': 738 {739 'coding': 740 [741 {742 'system': 'https://fhir.nhs.uk/R4/CodeSystem/Spine-ErrorOrWarningCode', 743 'version': '1', 744 'code': 'BAD_REQUEST', 745 'display': 'Bad request'746 }747 ]748 }, 749 'diagnostics': 'Resource Not Found'750 }751 ]752 }753 # When754 response = requests.get(url=config.REASONABLE_ADJUSTMENTS_BASE_URL + '/' +755 config.REASONABLE_ADJUSTMENTS_PROXY_PATH + '/test')756 actual_response = json.loads(response.text)757 # Then758 assert_that(expected_status_code).is_equal_to(response.status_code)759 assert_that(expected_response['resourceType']).is_equal_to_ignoring_case(actual_response['resourceType'])760 assert_that(expected_response['issue'][0]['code']).is_equal_to_ignoring_case(761 actual_response['issue'][0]['code'])762 assert_that(expected_response['issue'][0]['details']['coding'][0]['code']).is_equal_to_ignoring_case(763 actual_response['issue'][0]['details']['coding'][0]['code'])764 assert_that(expected_response['issue'][0]['details']['coding'][0]['display']).is_equal_to_ignoring_case(765 actual_response['issue'][0]['details']['coding'][0]['display'])766 assert_that(expected_response['issue'][0]['diagnostics']).is_equal_to_ignoring_case(767 actual_response['issue'][0]['diagnostics'])768 @pytest.mark.errors769 @pytest.mark.integration770 @pytest.mark.usefixtures('get_token_internal_dev')771 def test_duplicate_consent_record(self):772 # Pre-Req773 Utils.send_consent_post(self.token)774 # Given775 expected_status_code = 422776 # When777 response = requests.post(778 url=config.REASONABLE_ADJUSTMENTS_CONSENT,779 json=request_bank.get_body(Request.CONSENT_POST),780 headers={...

Full Screen

Full Screen

test_proxy.py

Source:test_proxy.py Github

copy

Full Screen

...87 actual_jwt = debug_session.get_apigee_variable('spineJwt')88 # We manually decode jwt because, jwt library requires all three segments but we only have two (no signature).89 jwt_segments = actual_jwt.split('.')90 actual_jwt_claims = json.loads(base64.b64decode(jwt_segments[1]))91 assert_that(expected_jwt_claims['reason_for_request']).is_equal_to_ignoring_case(actual_jwt_claims['reason_for_request'])92 assert_that(expected_jwt_claims['scope']).is_equal_to_ignoring_case(actual_jwt_claims['scope'])93 assert_that(expected_jwt_claims['requesting_organization']).is_equal_to_ignoring_case(actual_jwt_claims['requesting_organization'])94 assert_that(expected_jwt_claims['requesting_system']).is_equal_to_ignoring_case(actual_jwt_claims['requesting_system'])95 assert_that(expected_jwt_claims['requesting_user']).is_equal_to_ignoring_case(actual_jwt_claims['requesting_user'])96 assert_that(expected_jwt_claims['sub']).is_equal_to_ignoring_case(actual_jwt_claims['sub'])97 assert_that(expected_jwt_claims['iss']).is_equal_to_ignoring_case(actual_jwt_claims['iss'])98 assert_that(expected_jwt_claims['aud']).is_equal_to_ignoring_case(actual_jwt_claims['aud'])99 @pytest.mark.integration100 @pytest.mark.usefixtures('get_token_internal_dev')101 def test_response_contains_request_id_and_correlation_id_headers(self):102 request_id = str(uuid.uuid4())103 correlation_id = str(uuid.uuid4())104 response = requests.get(105 url=config.REASONABLE_ADJUSTMENTS_CONSENT,106 params={107 'patient': config.TEST_PATIENT_NHS_NUMBER,108 'category': 'https://fhir.nhs.uk/STU3/CodeSystem/RARecord-FlagCategory-1|NRAF',109 'status': 'active',110 '_from': 'json'111 },112 headers={...

Full Screen

Full Screen

test_insider.py

Source:test_insider.py Github

copy

Full Screen

...20 chosen_department = qa_open_positions_page.get_value_of_department_filter()21 if "\n" in chosen_department:22 chosen_department = chosen_department[2:]23 with soft_assertions():24 assert_that(chosen_department).is_equal_to_ignoring_case("quality assurance")25 # check that job list is not empty26 qa_open_positions_page.verify_jobs_list_exists()27 # choose location28 qa_open_positions_page.filter_by_location(location_name="Istanbul, Turkey")29 qa_open_positions_page.filter_by_department(department_name="Quality Assurance")30 titles = qa_open_positions_page.get_position_titles()31 logging.debug("Position titles: \n{titles}".format(titles=titles))32 for title in titles:33 assert_that("quality assurance" in title.lower() or "qa" in title.lower()).is_true()34 locations = qa_open_positions_page.get_position_locations()35 logging.debug("Position locations: \n{locations}".format(locations=locations))36 for location in locations:37 assert_that(location).is_equal_to("Istanbul, Turkey")38 departments = qa_open_positions_page.get_position_departments()39 logging.debug("Position departments: \n{departments}".format(departments=departments))40 for department in departments:41 assert_that(department).is_equal_to("Quality Assurance")42 qa_open_positions_page.verify_apply_button_exists()43 # click to first position in list44 position_to_apply = titles[0]45 qa_open_positions_page.click_apply_to_of_position(position_to_apply)46 web_browser.switch_to.window(web_browser.window_handles[1])47 application_form_page = LeverApplicationFormPage(web_browser)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run assertpy automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful