Improvements of test for image registry

* Also some code improvements have been added

Change-Id: If31223e94f8e4d6c1c8cc29c80fec9cc8f5746b6
Merge "Improvements of test for image registry"