[tests/functional/cache] Refactor to be less redundant.
[tests/functional/cache] Refactor to be less redundant.

pradyunsg/pip,sbidoul/pip,pradyunsg/pip,pypa/pip,sbidoul/pip,pfmoore/pip,pfmoore/pip,pypa/pip