예제 #1
0
 def verify_fhir_instance(self, fhir_obj):
         issues = fhir_obj.issue
         self.assertEqual(1, len(issues))
         first_issue = issues[0]
         self.assertEqual(first_issue.code, Stu3IssueTypeConfig.get_fhir_code_for_exception())
         self.assertEqual(first_issue.severity, IssueSeverity.ERROR.value)
         details = first_issue.details
         self.assertTrue(isinstance(details, CodeableConcept))
         self.assertEqual(details.text, "The request cannot be processed due to the following issues:\nError message")
 def build_for_fhir_claim_submit_error(cls, obj):
     severity = IssueSeverity.ERROR.value
     code = Stu3IssueTypeConfig.get_fhir_code_for_exception()
     details_text = obj.msg
     return cls.build_outcome(severity, code, details_text)
 def build_for_generic_error(cls, obj):
     severity = IssueSeverity.ERROR.value
     code = Stu3IssueTypeConfig.get_fhir_code_for_exception()
     details_text = cls.get_last_message(obj)
     return cls.build_outcome(severity, code, details_text)
 def build_for_key_api_exception(cls, obj):
     severity = IssueSeverity.FATAL.value
     code = Stu3IssueTypeConfig.get_fhir_code_for_exception()
     details_text = obj.detail
     return cls.build_outcome(severity, code, details_text)
 def build_for_400_bad_request(cls, details_text=None):
     severity = IssueSeverity.ERROR.value
     code = Stu3IssueTypeConfig.get_fhir_code_for_exception()
     return cls.build_outcome(severity, code, details_text)
 def build_for_404(cls):
     severity = IssueSeverity.ERROR.value
     code = Stu3IssueTypeConfig.get_fhir_code_for_not_found()
     return cls.build_outcome(severity, code)
 def build_for_http_response(cls, obj):
     severity = IssueSeverity.INFORMATION.value
     code = Stu3IssueTypeConfig.get_fhir_code_for_informational()
     details_text = obj.content.decode("utf-8")
     return cls.build_outcome(severity, code, details_text)
 def build_for_IntegrityError(cls, obj):
     severity = IssueSeverity.FATAL.value
     code = Stu3IssueTypeConfig.get_fhir_code_for_exception()
     details_text = obj.args[1]
     return cls.build_outcome(severity, code, details_text)
 def verify_deleted_response(self, response):
     self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
     operation_outcome = self.get_fhir_obj_from_json_response(response)
     self.assertTrue(isinstance(operation_outcome, OperationOutcome))
     self.assertEqual(Stu3IssueTypeConfig.get_fhir_code_for_not_found(),
                      operation_outcome.issue[0].code)