Some refactoring and adding tests to query PushEndpointURLs