def setup(self): factory = TestRecordMetadata.create_from_file( __name__, "test_orcid_tasks_orcid_push_TestOrcidPush.json") self.orcid = "0000-0003-1134-6827" self.recid = factory.record_metadata.json["control_number"] self.inspire_record = factory.inspire_record self.cache = OrcidCache(self.orcid, self.recid) self.oauth_token = get_local_access_tokens(self.orcid) or "mytoken"
def setup(self): self.recid = "1936475" self.putcode = "myputcode" self.hash_value = "myhash" self.orcid = "0000-0002-76YY-56XX" self.hash_value = "sha1:acbc7dad4fd46e0deb60d6681c244a67e4be2543" factory = TestRecordMetadata.create_from_file( __name__, "test_orcid_cache_record.json") self.inspire_record = factory.inspire_record self.cache = OrcidCache(self.orcid, self.recid)
def cache(self): return OrcidCache(self.orcid, self.recid)
def cache_clashing(self): return OrcidCache(self.orcid, self.clashing_recid)
def test_delete_work_putcode_non_existing(self): recid = "0000" cache = OrcidCache(self.orcid, recid) cache.delete_work_putcode() assert not self.cache.read_work_putcode()
def test_has_work_content_changed_yes(self): self.cache.write_work_putcode(self.putcode, self.inspire_record) self.inspire_record["titles"][0]["title"] = "mytitle" cache = OrcidCache(self.orcid, self.recid) assert cache.has_work_content_changed(self.inspire_record)
def test_has_work_content_changed_no(self): self.cache.write_work_putcode(self.putcode, self.inspire_record) cache = OrcidCache(self.orcid, self.recid) assert not cache.has_work_content_changed(self.inspire_record)