'Ensure that image locations can be removed.
Image locations should be able to be removed as long as the image has
fewer than the limited number of image locations after the
transaction.'

def test_update_remove_location_while_over_limit(self):

    self.config(show_multiple_locations=True)
    request = unit_test_utils.get_fake_request()
    changes = [{'op': 'add', 'path': ['locations', '-'], 'value': {'url': ('%s/fake_location_1' % BASE_URI), 'metadata': {}}}, {'op': 'add', 'path': ['locations', '-'], 'value': {'url': ('%s/fake_location_2' % BASE_URI), 'metadata': {}}}]
    self.controller.update(request, UUID1, changes)
    self.config(image_location_quota=1)
    self.config(show_multiple_locations=True)
    changes = [{'op': 'remove', 'path': ['locations', '0']}, {'op': 'remove', 'path': ['locations', '0']}]
    output = self.controller.update(request, UUID1, changes)
    self.assertEqual(UUID1, output.image_id)
    self.assertEqual(1, len(output.locations))
    self.assertIn('fake_location_2', output.locations[0]['url'])
    self.assertNotEqual(output.created_at, output.updated_at)
