def test_exists(self, kg_client): p1 = Person("Hamilton", "Margaret", "*****@*****.**", KGProxy(Organization, "http://fake_uuid_855fead8"), id="http://fake_uuid_8ab3dc739b") assert p1.exists(kg_client, api="nexus") p2 = Person("James", "Bond", "*****@*****.**") p2_exists = p2.exists(kg_client, api="nexus") assert not p2_exists p3_noid = Person("Johnson", "Katherine", "*****@*****.**") p3_exists = p3_noid.exists(kg_client, api="nexus") assert p3_exists
def _save_person_in_KG(self, first_name, last_name, email): person = Person(family_name=last_name, given_name=first_name, email=email, affiliation='') if not person.exists(NAR_client): person.save(NAR_client) logger.debug('saved in KG: %s', person) else: logger.debug('already exists in KG: %s', person)