def test_extract_parent_from_hash_failure(): """ Testing extracting parent duns/name from recipient hash but with recipient lookup removed as there may be cases where the parent recipient is not found/listed """ # This one specifically has to be a child recipient_id = "392052ae-92ab-f3f4-d9fa-b57f45b7750b-C" recipient_hash = TEST_RECIPIENT_PROFILES[recipient_id]["recipient_hash"] parent_duns = TEST_RECIPIENT_PROFILES[recipient_id]["recipient_affiliations"][0] mommy.make("recipient.RecipientProfile", **TEST_RECIPIENT_PROFILES[recipient_id]) expected_name = None expected_duns = parent_duns expected_parent_id = None parents = recipients.extract_parents_from_hash(recipient_hash) assert expected_duns == parents[0]["parent_duns"] assert expected_name == parents[0]["parent_name"] assert expected_parent_id == parents[0]["parent_id"]
def test_extract_parent_from_hash_failure(): """ Testing extracting parent duns/name from recipient hash but with recipient lookup removed as there may be cases where the parent recipient is not found/listed """ # This one specifically has to be a child recipient_id = '392052ae-92ab-f3f4-d9fa-b57f45b7750b-C' recipient_hash = TEST_RECIPIENT_PROFILES[recipient_id]['recipient_hash'] parent_duns = TEST_RECIPIENT_PROFILES[recipient_id]['recipient_affiliations'][0] mommy.make(RecipientProfile, **TEST_RECIPIENT_PROFILES[recipient_id]) expected_name = None expected_duns = parent_duns expected_parent_id = None parents = recipients.extract_parents_from_hash(recipient_hash) assert expected_duns == parents[0]["parent_duns"] assert expected_name == parents[0]["parent_name"] assert expected_parent_id == parents[0]["parent_id"]
def test_extract_parent_from_hash(): """ Testing extracting parent duns/name from recipient hash""" # This one specifically has to be a child recipient_id = "392052ae-92ab-f3f4-d9fa-b57f45b7750b-C" recipient_hash = TEST_RECIPIENT_PROFILES[recipient_id]["recipient_hash"] parent_duns = TEST_RECIPIENT_PROFILES[recipient_id]["recipient_affiliations"][0] mommy.make("recipient.RecipientProfile", **TEST_RECIPIENT_PROFILES[recipient_id]) expected_parent_id = "00077a9a-5a70-8919-fd19-330762af6b84-P" parent_hash = expected_parent_id[:-2] mommy.make("recipient.RecipientLookup", **TEST_RECIPIENT_LOOKUPS[parent_hash]) expected_name = TEST_RECIPIENT_LOOKUPS[parent_hash]["legal_business_name"] expected_duns = parent_duns parents = recipients.extract_parents_from_hash(recipient_hash) assert expected_duns == parents[0]["parent_duns"] assert expected_name == parents[0]["parent_name"] assert expected_parent_id == parents[0]["parent_id"]
def test_extract_parent_from_hash(): """ Testing extracting parent duns/name from recipient hash""" # This one specifically has to be a child recipient_id = '392052ae-92ab-f3f4-d9fa-b57f45b7750b-C' recipient_hash = TEST_RECIPIENT_PROFILES[recipient_id]['recipient_hash'] parent_duns = TEST_RECIPIENT_PROFILES[recipient_id]['recipient_affiliations'][0] mommy.make(RecipientProfile, **TEST_RECIPIENT_PROFILES[recipient_id]) expected_parent_id = '00077a9a-5a70-8919-fd19-330762af6b84-P' parent_hash = expected_parent_id[:-2] mommy.make(RecipientLookup, **TEST_RECIPIENT_LOOKUPS[parent_hash]) expected_name = TEST_RECIPIENT_LOOKUPS[parent_hash]['legal_business_name'] expected_duns = parent_duns parents = recipients.extract_parents_from_hash(recipient_hash) assert expected_duns == parents[0]["parent_duns"] assert expected_name == parents[0]["parent_name"] assert expected_parent_id == parents[0]["parent_id"]