def METHOD_NAME(
    running_app, client, minimal_record, headers, search_clear, uploader
):
    """Tests for issue #845."""
    client = uploader.login(client)
    doi1 = "10.4321/1"
    doi2 = "10.4321/2"
    doi3 = "10.4321/3"
    # Publish two record with different external DOIs.
    r1_data = deepcopy(minimal_record)
    r2_data = deepcopy(minimal_record)
    r1_data["pids"] = {"doi": {"provider": "external", "identifier": doi1}}
    r2_data["pids"] = {"doi": {"provider": "external", "identifier": doi2}}
    record1 = publish_record(client, r1_data, headers)
    record2 = publish_record(client, r2_data, headers)
    def _change_doi(record, doi):
        # Edit mode
        draft = client.post(link(record["links"]["draft"]))
        assert draft.status_code == 201
        # Update
        data = draft.json
        data["pids"]["doi"]["identifier"] = doi
        res = client.put(link(draft.json["links"]["self"]), headers=headers, json=data)
        assert res.status_code == 200
        # Publish
        record = client.post(link(draft.json["links"]["publish"]), headers=headers)
        assert record.status_code == 202
        return record
    # Edit record 1 to use a DOI 3, and edit record 2 to use doi 1 (should be
    # possible because it was just released from record 1)
    record1 = _change_doi(record1, doi3)
    record2 = _change_doi(record2, doi1)