def test_delete_nonexistent(self): """Test that a delete request for a nonexistant id fails""" img_id = FLAGS.nonexistent_image dtutil.assert_raises(glance.common.exception.NotFound, self.glance_connection.delete_image, img_id)
def test_create_from_nonexistent_flavor(self): """Verify an error is returned if an invalid flavor is requested""" dtutil.assert_raises( novaclient.OpenStackException, self.os.servers.create, name="nonexistent_flavor", image=FLAGS.image, flavor=FLAGS.nonexistent_flavor, )
def test_unshare(self): """Test that we can unshare an IP address.""" # In the actual test, we'll want to confirm that a shared IP # address can be unshared from a group # Try to unshare from the group--fails for now (operation not # implemented in nova); note: change '10.0.0.1' to IP dtutil.assert_raises(novaclient.OpenStackException, self.server.unshare_ip, '10.0.0.1')
def test_share(self): """Test that we can share an IP address.""" # In the actual test, we'll want to confirm that an IP address # can be shared to a group # Try to share with the group--fails for now (operation not # implemented in nova); note: change 1 to group, '10.0.0.1' to IP dtutil.assert_raises(novaclient.OpenStackException, self.server.share_ip, 1, '10.0.0.1', True)
def test_list(self): """Test that we can list the details of an IP group.""" # In the actual test, we'll want to create a group or two for # list() to act on here # Try to list the groups--fails for now (operation not # implemented in nova) dtutil.assert_raises(novaclient.OpenStackException, self.os.ipgroups.list)
def test_get(self): """Test that we can get the details of an IP group.""" # In the actual test, we'll want to create a group for get() # to act on here # Try to get the group--fails for now (operation not # implemented in nova) dtutil.assert_raises(novaclient.OpenStackException, self.os.ipgroups.get, 1) # change 1 to group
def test_create(self): """Test that we can create an IP group.""" # Start by creating a random IP group name name = self.randName() # Try to create the group--fails for now (operation not # implemented in nova) dtutil.assert_raises(novaclient.OpenStackException, self.os.ipgroups.create, name)
def test_get_nonexistent(self): """Test that a get request for a nonexistant id fails""" img_id = FLAGS.nonexistent_image # test via nova client dtutil.assert_raises(novaclient.exceptions.NotFound, self.os.images.get, img_id) # test via glance client dtutil.assert_raises(glance.common.exception.NotFound, self.glance_connection.get_image, img_id)
def test_create_and_delete(self): """Test that an image can be created and deleted.""" name = self.randName(prefix="create_delete_image_") # Create a new image new_meta = self.create_glance_image(file_name=FLAGS.test_image, image_name=name) # Verify it exists and the values are correct img = self.os.images.get(new_meta['id']) dtutil.assert_equal(img.id, new_meta['id']) dtutil.assert_equal(img.name, new_meta['name']) dtutil.assert_equal(img.status, 'ACTIVE') # Delete the image self.glance_connection.delete_image(new_meta['id']) # Verify it cannot be retrieved dtutil.assert_raises(novaclient.exceptions.NotFound, self.os.images.get, new_meta['id'])
def assert_raises_regexp(expected_exception, expected_regexp, callable_obj=None, *args, **kwargs): return util.assert_raises( expected_exception, callableObj=callable_obj, matchRegExp=expected_regexp, *args, **kwargs )
def test_get_nonexistent_server(self): """Verify that a request for a nonexistant server fails""" dtutil.assert_raises(novaclient.OpenStackException, self.os.servers.get, FLAGS.nonexistent_image)
def test_get_nonexistent(self): """Test that we get an appropriate error for a bad flavor.""" dtutil.assert_raises(novaclient.exceptions.NotFound, self.os.flavors.get, FLAGS.nonexistent_flavor)