Refactor to ease testing

getFromScratchUrl:
* Do only one things
* Less external dependencies

Change-Id: I77436763c3116a4f52c0ededf4efe61caa7b738e