Пример #1
0
    def setUp(self):
        super(ImageViewTests, self).setUp()
        image_dict = {'name': 'visibleImage',
                      'container_format': 'novaImage'}
        self.visibleImage = api.Image(image_dict)
        self.visibleImage.id = '1'

        image_dict = {'name': 'invisibleImage',
                      'container_format': 'aki'}
        self.invisibleImage = api.Image(image_dict)
        self.invisibleImage.id = '2'

        self.images = (self.visibleImage, self.invisibleImage)

        flavor = api.Flavor(None)
        flavor.id = 1
        flavor.name = 'm1.massive'
        flavor.vcpus = 1000
        flavor.disk = 1024
        flavor.ram = 10000
        self.flavors = (flavor,)

        keypair = api.KeyPair(None)
        keypair.name = 'keyName'
        self.keypairs = (keypair,)

        security_group = api.SecurityGroup(None)
        security_group.name = 'default'
        self.security_groups = (security_group,)
 def test_get_other_missing(self):
     image = api.Image(self.WITHOUT_PROPERTIES)
     with self.assertRaises(AttributeError):
         self.assertNotIn(
             'missing',
             image._attrs,
             msg="Test assumption broken.  Find new missing attribute")
         image.missing
    def test_image_name(self):
        image = api.Image(self.images.first())
        self.mox.StubOutWithMock(api.glance, 'image_get_meta')
        api.glance.image_get_meta(IsA(http.HttpRequest),
                                  image.id).AndReturn(image)
        self.mox.ReplayAll()

        server = api.Server(self.servers.first(), self.request)
        self.assertEqual(server.image_name, image.name)
Пример #4
0
    def setUp(self):
        super(ImageViewTests, self).setUp()
        image_dict = {'name': 'visibleImage',
                      'container_format': 'novaImage'}
        self.visibleImage = api.Image(image_dict)
        self.visibleImage.id = 1

        image_dict = {'name': 'invisibleImage',
                      'container_format': 'aki'}
        self.invisibleImage = api.Image(image_dict)
        self.invisibleImage.id = 2

        self.images = (self.visibleImage, self.invisibleImage)

        flavor = api.Flavor(None)
        flavor.id = 1
        flavor.name = 'm1.massive'
        flavor.vcpus = 1000
        flavor.disk = 1024
        flavor.ram = 10000
        self.flavors = (flavor,)

        keypair = api.KeyPair(None)
        keypair.name = 'keyName'
        self.keypairs = (keypair,)

        security_group = api.SecurityGroup(None)
        security_group.name = 'default'
        self.security_groups = (security_group,)

        volume = api.Volume(None)
        volume.id = 1
        volume.name = 'vol'
        volume.status = 'available'
        volume.size = 40
        volume.displayName = ''
        self.volumes = (volume,)
Пример #5
0
    def setUp(self):
        super(ImagesAndSnapshotsTests, self).setUp()
        snapshot_properties = api.glance.ImageProperties(None)
        snapshot_properties.image_type = u'snapshot'

        snapshot_dict = {
            'name': u'snapshot',
            'container_format': u'ami',
            'id': 3
        }
        snapshot = api.glance.Image(snapshot_dict)
        snapshot.properties = snapshot_properties
        self.snapshots = [snapshot]

        image_properties = api.glance.ImageProperties(None)
        image_properties.image_type = u'image'

        image_dict = {
            'name': u'visibleImage',
            'container_format': u'novaImage'
        }
        self.visibleImage = api.glance.Image(image_dict)
        self.visibleImage.id = '1'
        self.visibleImage.properties = image_properties

        image_dict = {'name': 'invisibleImage', 'container_format': 'aki'}
        self.invisibleImage = api.Image(image_dict)
        self.invisibleImage.id = '2'

        flavor = api.Flavor(None)
        flavor.id = 1
        flavor.name = 'm1.massive'
        flavor.vcpus = 1000
        flavor.disk = 1024
        flavor.ram = 10000
        self.flavors = (flavor, )

        self.images = (self.visibleImage, self.invisibleImage)

        keypair = api.KeyPair(None)
        keypair.name = 'keyName'
        self.keypairs = (keypair, )

        security_group = api.SecurityGroup(None)
        security_group.name = 'default'
        self.security_groups = (security_group, )
 def test_get_properties(self):
     image = api.Image(self.WITH_PROPERTIES)
     image_props = image.properties
     self.assertIsInstance(image_props, api.ImageProperties)
     self.assertEqual(image_props.image_state, 'running')
 def test_get_properties_missing(self):
     image = api.Image(self.WITHOUT_PROPERTIES)
     with self.assertRaises(AttributeError):
         image.properties
 def test_get_other(self):
     image = api.Image(self.WITH_PROPERTIES)
     self.assertEqual(image.size, 100)