'Run before each test.'

def setUp(self):

    super(ImagesControllerTestV21, self).setUp()
    self.flags(api_servers=['http://localhost:9292'], group='glance')
    fakes.stub_out_networking(self)
    fakes.stub_out_key_pair_funcs(self)
    fakes.stub_out_compute_api_snapshot(self.stubs)
    fakes.stub_out_compute_api_backup(self.stubs)
    self.controller = self.image_controller_class()
    self.url_prefix = ('http://localhost%s/images' % self.url_base)
    self.bookmark_prefix = ('http://localhost%s/images' % self.bookmark_base)
    self.uuid = 'fa95aaf5-ab3b-4cd8-88c0-2be7dd051aaf'
    self.server_uuid = 'aa640691-d1a7-4a67-9d3c-d35ee6b3cc74'
    self.server_href = ('http://localhost%s/servers/%s' % (self.url_base, self.server_uuid))
    self.server_bookmark = ('http://localhost%s/servers/%s' % (self.bookmark_base, self.server_uuid))
    self.alternate = '%s/images/%s'
    self.expected_image_123 = {'image': {'id': '123', 'name': 'public    image', 'metadata': {'key1': 'value1'}, 'updated': NOW_API_FORMAT, 'created': NOW_API_FORMAT, 'status': 'ACTIVE', 'minDisk': 10, 'progress': 100, 'minRam': 128, 'links': [{'rel': 'self', 'href': ('%s/123' % self.url_prefix)}, {'rel': 'bookmark', 'href': ('%s/123' % self.bookmark_prefix)}, {'rel': 'alternate', 'type': 'application/vnd.openstack.image', 'href': (self.alternate % (glance.generate_glance_url(), 123))}]}}
    self.expected_image_124 = {'image': {'id': '124', 'name': 'queued    snapshot', 'metadata': {u'instance_uuid': self.server_uuid, u'user_id': u'fake'}, 'updated': NOW_API_FORMAT, 'created': NOW_API_FORMAT, 'status': 'SAVING', 'progress': 25, 'minDisk': 0, 'minRam': 0, 'server': {'id': self.server_uuid, 'links': [{'rel': 'self', 'href': self.server_href}, {'rel': 'bookmark', 'href': self.server_bookmark}]}, 'links': [{'rel': 'self', 'href': ('%s/124' % self.url_prefix)}, {'rel': 'bookmark', 'href': ('%s/124' % self.bookmark_prefix)}, {'rel': 'alternate', 'type': 'application/vnd.openstack.image', 'href': (self.alternate % (glance.generate_glance_url(), 124))}]}}
