fixes #6856 - API v2 - more efficient import puppetclasses for single environment

@eLobato, updated the test in commit to squash. What hung me up is that even though I don't check for `classes.with('env2')`, I needed to declare it or there was an error.