refactor API Key tests