Skip to content

Commit

Permalink
Merge pull request #15 from BBMRI-cz/blaze_client_changes
Browse files Browse the repository at this point in the history
Blaze client changes
  • Loading branch information
SimonKonar authored Nov 4, 2024
2 parents 002a718 + 0dea2a2 commit bb7b7fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion miabis_model/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def from_json(cls, collection_json: dict, managing_collection_organization_id: s
characteristics = cls._get_characteristics(collection_json["characteristic"])
managing_collection_fhir_id = parse_reference_id(
get_nested_value(collection_json, ["managingEntity", "reference"]))
extensions = cls._get_extensions(collection_json["extension"])
extensions = cls._get_extensions(collection_json.get("extension", []))
instance = cls(identifier, name, managing_collection_organization_id, characteristics["sex"],
characteristics["material_type"], characteristics["age_range_low"],
characteristics["age_range_high"], characteristics["storage_temperature"],
Expand Down
14 changes: 11 additions & 3 deletions test/service/test_blaze_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class TestBlazeService(unittest.TestCase):
"description",
"LifeStyle", "Human", "Environment", ["CaseControl"],
["CommercialUse"], ["publication"])
example_collection = Collection("collectionId", "collectionName", "collectionOrgId", [Gender.MALE], ["DNA"],
inclusion_criteria=["HealthStatus"])
example_collection = Collection("collectionId", "collectionName", "collectionOrgId", [Gender.MALE], ["DNA"],)
# inclusion_criteria=["HealthStatus"])

example_network_org = NetworkOrganization("networkOrgId", "networkOrgName", "biobankId", "contactName",
"contactSurname", "contactEmail", "country", ["Charter"],
Expand Down Expand Up @@ -102,6 +102,15 @@ def test_blaze_service_unreachable_raises_httpError(self):
def test_is_resource_present_in_blaze_false(self):
self.assertFalse(self.blaze_service.is_resource_present_in_blaze("Patient", "nonexistentId"))

def test_is_resource_present_in_blaze_with_search_param_true(self):
self.blaze_service.upload_donor(self.example_donor)
self.assertTrue(
self.blaze_service.is_resource_present_in_blaze("Patient", self.example_donor.identifier, "identifier"))

def test_is_resource_present_in_blaze_with_search_param_false(self):
self.assertFalse(
self.blaze_service.is_resource_present_in_blaze("Patient", "nonexistentIdentifier", "identifier"))

def test_get_fhir_resource_as_json_existing(self):
donor_fhir_id = self.blaze_service.upload_donor(self.example_donor)
donor_json = self.blaze_service.get_fhir_resource_as_json("Patient", donor_fhir_id)
Expand Down Expand Up @@ -769,4 +778,3 @@ def test_delete_sample_present_in_collection(self):
self.assertTrue(updated)
deleted = self.blaze_service.delete_sample(sample_fhir_id1)
self.assertTrue(deleted)

0 comments on commit bb7b7fc

Please sign in to comment.