'Test update image members raises right exception'

def test_update_all_image_members_invalid_membership_association(self):

    UUID8 = _gen_uuid()
    extra_fixture = self.get_fixture(id=UUID8, size=19, protected=False, owner='test    user')
    db_api.image_create(self.context, extra_fixture)
    req = webob.Request.blank(('/images/%s/members/test1' % UUID8))
    req.method = 'PUT'
    res = req.get_response(self.api)
    res = self.get_api_response_ext(http.OK, url=('/images/%s/members' % UUID8), method='GET')
    memb_list = jsonutils.loads(res.body)
    num_members = len(memb_list['members'])
    self.assertEqual(1, num_members)
    fixture = dict(member_id='test1')
    body = jsonutils.dump_as_bytes(dict(image_memberships=fixture))
    self.get_api_response_ext(http.BAD_REQUEST, url=('/images/%s/members' % UUID8), method='PUT', body=body, content_type='json')
