puppetlabs/puppetdb — pull request #818 by kbarber (2014-01-30 13:17:40+00:00)
Title: PDB-341 Fix some API version crossover issues

This patch fixes the immediate bug provided with PDB-341:

* select-resources not working for file/line in v3 api

But as a consequence of solving this problem we've found other inconsistencies
with the API:

* v3 of the resources end-point was using the v2 of the 'not' operator
* v3 of the resources end-point was using the v2 fact operators for select-facts

In short, these bugs can be put down to copy & paste errors when we cut the v3
release. The facts end-point in particular still had a lot of code pointing at
v2 api stuff which was fine when these were backwards compatible but in some
cases this has caused problems as we have found.

The patch here breaks up the facts endpoints into their versioned counterparts
as you would expect to hopefully avoid this issue. In the future we should
find a better way to version and decompose this (for example, using a multi-method,
condp or other 'case' still look for version behaviour for all the operators).

I've also copied over the testing from the v1 and v2 endpoints that was missing
from v3. I've achieved this by combining the tests into a single file and simply
iterating over the v2 and v3 end-points.

Also, I've removed the use of custom 'get-request' functions all over the place
since this was making the development inconsistent. There was also a minor
variant known as 'make-request' which I've removed.

'endpoint' is now declared at the top of each test to be re-used again to reduce
any copy and paste errors in the future as well.

Any other changes include either modifying items to fix bugs from the above
changes or a general increase in coverage where I saw it needed it.

Signed-off-by: Ken Barber