Esempio n. 1
0
 def post(self):
     try:
         my_data = decode_response_json(request.data)
         phaxio_request_body = build_faxio_request(my_data)
         response_data = make_faxio_request(phaxio_request_body)
         if not response_data.get('success', None):
             abort(400, status="Failed", message="Issue with fax")
         client_response = {
             "status": "Success!",
             "fax_id": response_data['faxId']
         }
         return client_response
     except BadRequest:
         raise
     except Exception as e:
         abort(400, message=e.args[0], status="Failed")
Esempio n. 2
0
 def test_it_builds_valid_dictionary(self, valid_fax_info):
     fax_info_dict = valid_fax_info
     faxio_request_dict = build_faxio_request(fax_info_dict)
     assert faxio_request_dict["string_data"] == (
         "This is a fax generated by the Kansas City, "
         "Missouri Health Department's FaxVax Service. "
         "If you have any questions fulfiling it, "
         "please contact us at __________.\n\n"
         "Request Information:\n"
         "Child Name: Banjo Edelman\n"
         "Child DOB: 08/01/2010\nSchool District: "
         "KCP 33\nSchool Name: Faxon Elementary "
         "School\nSchool Fax: 555-555-5556\n"
         "Requestor Name: Rachel Edelman\nRequestor "
         "Contact Info: 555-555-5555"
     )
     faxio_request_dict["header_text"] == ("Youth Application for Vaccination Records")
     assert isinstance(faxio_request_dict["tag[request_id]"], str)