refactored getCredentialsFromFile, added tests