Esempio n. 1
0
    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)
Esempio n. 2
0
 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,
     )
Esempio n. 3
0
    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')
Esempio n. 4
0
    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)
Esempio n. 5
0
    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)
Esempio n. 6
0
    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
Esempio n. 7
0
    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)
Esempio n. 8
0
    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)
Esempio n. 9
0
    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'])
Esempio n. 10
0
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
    )
Esempio n. 11
0
 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)
Esempio n. 12
0
    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)