def test_id_is_not_written_to_record_for_stale_data_push( mock_hal_create, mock_update_record_with_new_ids, inspire_app, get_fixture ): hal_create_receipt = Deposit_Receipt() hal_create_receipt.id = "hal:123456" mock_hal_create.return_value = hal_create_receipt def side_effect(*args, **kwargs): if side_effect.counter == 0: side_effect.counter += 1 raise StaleDataError else: return update_record_with_new_ids(*args, **kwargs) side_effect.counter = 0 mock_update_record_with_new_ids.side_effect = side_effect record_json = orjson.loads(get_fixture("hal_preprod_record.json")) record_data = faker.record("lit", data=record_json) record = InspireRecord.create(record_data) institute_json = orjson.loads(get_fixture("hal_preprod_institute.json")) institute_data = faker.record("ins", data=institute_json) InspireRecord.create(institute_data) _hal_push(record) record = InspireRecord.get_record_by_pid_value(record["control_number"], "lit") assert get_values_for_schema(record["external_system_identifiers"], "HAL") == [ "hal:123456" ]
def test_01_init(self): dr = Deposit_Receipt(DR) assert dr.metadata['dcterms_title'] == "Title" assert dr.metadata['atom_id'] == "info:something:1" assert dr.id == "info:something:1" assert dr.title == "My Deposit" assert dr.metadata['sword_verboseDescription'] == "Verbose description"
def test_03_content_iri(self): dr = Deposit_Receipt(DR) assert dr.edit == "http://www.swordserver.ac.uk/col1/mydeposit.atom" assert "http://www.swordserver.ac.uk/col1/mydeposit" in dr.content.keys( ) assert dr.content["http://www.swordserver.ac.uk/col1/mydeposit"][ 'type'] == "application/zip" # Check convenience attribute 'cont_iri' assert dr.cont_iri == "http://www.swordserver.ac.uk/col1/mydeposit"
def test_04_packaging(self): dr = Deposit_Receipt(DR) assert "http://purl.org/net/sword/package/BagIt" in dr.packaging assert len(dr.packaging) == 1
def test_02_edit(self): dr = Deposit_Receipt(DR) assert dr.edit == "http://www.swordserver.ac.uk/col1/mydeposit.atom" assert dr.edit_media == "http://www.swordserver.ac.uk/col1/mydeposit"