def fetch_image(self, image_id):
        """Return image json metadata, checksum and its blob."""
        resp = requests.get('{0}/v1/images/{1}/json'.format(
            self.registry_endpoint, image_id),
        )
        self.assertEqual(resp.status_code, 200, resp.text)

        resp = requests.get('{0}/v1/images/{1}/json'.format(
            self.registry_endpoint, image_id),
            headers={'Authorization': 'Token ' + self.token}
        )
        self.assertEqual(resp.status_code, 200, resp.text)

        json_data = resp.text
        checksum = resp.headers['x-docker-payload-checksum']

        resp = requests.get('{0}/v1/images/{1}/layer'.format(
            self.registry_endpoint, image_id),
        )
        self.assertEqual(resp.status_code, 200, resp.text)

        resp = requests.get('{0}/v1/images/{1}/layer'.format(
            self.registry_endpoint, image_id),
            headers={'Authorization': 'Token ' + self.token}
        )
        self.assertEqual(resp.status_code, 200, resp.text)
        return (json_data, checksum, resp.text)
Return image json metadata, checksum and its blob.
tests/workflow.py