示例#1
0
 def test_create(self):
     sot = volume.Volume(**VOLUME)
     self.assertEqual(VOLUME["id"], sot.id)
     self.assertEqual(VOLUME["status"], sot.status)
     self.assertEqual(VOLUME["attachments"], sot.attachments)
     self.assertEqual(VOLUME["availability_zone"], sot.availability_zone)
     self.assertFalse(sot.is_bootable)
     self.assertEqual(VOLUME["created_at"], sot.created_at)
     self.assertEqual(VOLUME["description"], sot.description)
     self.assertEqual(VOLUME["volume_type"], sot.volume_type)
     self.assertEqual(VOLUME["snapshot_id"], sot.snapshot_id)
     self.assertEqual(VOLUME["source_volid"], sot.source_volume_id)
     self.assertEqual(VOLUME["metadata"], sot.metadata)
     self.assertEqual(VOLUME["volume_image_metadata"],
                      sot.volume_image_metadata)
     self.assertEqual(VOLUME["size"], sot.size)
     self.assertEqual(VOLUME["imageRef"], sot.image_id)
     self.assertEqual(VOLUME["os-vol-host-attr:host"], sot.host)
     self.assertEqual(VOLUME["os-vol-tenant-attr:tenant_id"],
                      sot.project_id)
     self.assertEqual(VOLUME["os-vol-mig-status-attr:migstat"],
                      sot.migration_status)
     self.assertEqual(VOLUME["os-vol-mig-status-attr:name_id"],
                      sot.migration_id)
     self.assertEqual(VOLUME["replication_status"], sot.replication_status)
     self.assertEqual(VOLUME["os-volume-replication:extended_status"],
                      sot.extended_replication_status)
     self.assertEqual(VOLUME["consistencygroup_id"],
                      sot.consistency_group_id)
     self.assertEqual(VOLUME["os-volume-replication:driver_data"],
                      sot.replication_driver_data)
     self.assertFalse(sot.is_encrypted)
示例#2
0
    def test_extend(self):
        sot = volume.Volume(**VOLUME)

        self.assertIsNone(sot.extend(self.sess, '20'))

        url = 'volumes/%s/action' % FAKE_ID
        body = {"os-extend": {"new_size": "20"}}
        headers = {'Accept': ''}
        self.sess.post.assert_called_with(url, json=body, headers=headers)
示例#3
0
 def test_create(self):
     sot = volume.Volume(**VOLUME)
     self.assertEqual(VOLUME["id"], sot.id)
     self.assertEqual(VOLUME["status"], sot.status)
     self.assertEqual(VOLUME["attachments"], sot.attachments)
     self.assertEqual(VOLUME["availability_zone"], sot.availability_zone)
     self.assertFalse(sot.is_bootable)
     self.assertEqual(VOLUME["created_at"], sot.created_at)
     self.assertEqual(VOLUME["description"], sot.description)
     self.assertEqual(VOLUME["volume_type"], sot.volume_type)
     self.assertEqual(VOLUME["snapshot_id"], sot.snapshot_id)
     self.assertEqual(VOLUME["source_volid"], sot.source_volume_id)
     self.assertEqual(VOLUME["metadata"], sot.metadata)
     self.assertEqual(VOLUME["volume_image_metadata"],
                      sot.volume_image_metadata)
     self.assertEqual(VOLUME["size"], sot.size)
     self.assertEqual(VOLUME["imageRef"], sot.image_id)
    def test_basic(self):
        sot = volume.Volume(VOLUME)
        self.assertEqual("volume", sot.resource_key)
        self.assertEqual("volumes", sot.resources_key)
        self.assertEqual("/volumes", sot.base_path)
        self.assertEqual("block-storage", sot.service.service_type)
        self.assertTrue(sot.allow_get)
        self.assertTrue(sot.allow_create)
        self.assertTrue(sot.allow_update)
        self.assertTrue(sot.allow_delete)
        self.assertTrue(sot.allow_list)

        self.assertDictEqual({"name": "name",
                              "status": "status",
                              "all_tenants": "all_tenants",
                              "project_id": "project_id",
                              "limit": "limit",
                              "marker": "marker"},
                             sot._query_mapping._mapping)