示例#1
0
    def test_update_bad_resource_schema(self, store: FHIRStore, test_patient):
        """update() raises if json schema validation failed in mongo"""

        store.create(test_patient)
        with raises(ValidationError):
            store.update("Patient", test_patient["id"], {
                **test_patient, "gender": "elephant"
            })
示例#2
0
 def test_update_resource(self, store: FHIRStore, test_patient):
     """update() finds a document in the database"""
     store.create(test_patient)
     store.update("Patient", test_patient["id"], {
         **test_patient, "gender": "other"
     })
     assert store.read("Patient", test_patient["id"]) == {
         **test_patient, "gender": "other"
     }
示例#3
0
    def test_update_resource_not_found(self, store: FHIRStore, test_patient):
        """update() returns None when no matching document was found"""

        with raises(NotFoundError):
            store.update("Patient", test_patient["id"], {"name": "Patator"})
示例#4
0
    def test_update_bad_resource_type(self, store: FHIRStore):
        """update() raises if resource type is unknown"""

        with raises(NotFoundError,
                    match='unsupported FHIR resource: "unknown"'):
            store.update("unknown", "864321", {"gender": "other"})