Open groovytron opened 7 years ago
Another case could be that either the namespace
or the image
is empty (or None
). Adding a unit test for this case might be needed.
Also think about making tests at the API level to ensure that the API always answer with a valid HTTP status and the MicrobadgerService
does not slows it down too much (thinking about trying to push a non-existent docker image or an image that has been indexed in MicroBadger yet).
How to handle the cases where the image has not been indexed by MicroBadger?
Mock! mock! and mock!
MipApplication's model is populated using Microbadger's API using the
pre_save
method. How is it possible to handle a non-existent image and trigger an error?This part of the logic might have to be moved into the serializer. It's a good idea if the API is called only when the instance needs to be updated or created. Otherwise performances will be affected. It looks like it's only called on creation and update: http://www.django-rest-framework.org/api-guide/serializers/#validation