Adding unit tests for credentials.registerEndpoint

Made the change suggested