def METHOD_NAME(tmpdir, dirhash, tarfile_buf):
    provider = Swhid()
    adapter = requests_mock.Adapter()
    provider.base_url = "mock://api/1"
    provider.retry_delay = 0.1
    provider.session.mount("mock://", adapter)
    adapter.register_uri(
        "GET",
        f"mock://api/1/revision/{NULLID}/",
        json={
            "author": {"fullname": "John Doe <jdoe@example.com>"},
            "directory": dirhash,
        },
    )
    adapter.register_uri(
        "POST",
        f"mock://api/1/vault/directory/{dirhash}/",
        json={
            "fetch_url": f"mock://api/1/vault/directory/{dirhash}/raw/",
            "status": "new",
        },
    )
    adapter.register_uri(
        "GET",
        f"mock://api/1/vault/directory/{dirhash}/",
        [
            {
                "json": {
                    "fetch_url": f"mock://api/1/vault/directory/{dirhash}/raw/",
                    "status": "pending",
                }
            },
            {
                "json": {
                    "fetch_url": f"mock://api/1/vault/directory/{dirhash}/raw/",
                    "status": "done",
                }
            },
        ],
    )
    adapter.register_uri(
        "GET",
        f"mock://api/1/vault/directory/{dirhash}/raw/",
        content=tarfile_buf,
    )
    return provider