Narrow the return types to API types in tests.

This should drastically reduce the number of internal “hits” in plugins.
Merge pull request #830 from dragos/api/narrow-return-types-in-tests

Narrow the return types to API types in tests.