refactoring test_keys