Make listCookbooksInEnvironment return an empty set on 404

Added tests to validate above.
Also factored out some duplicate code in test.