コード例 #1
0
 def setUp(self):
     super(TestProtectedInstance, self).setUp()
     self.sess = mock.Mock(spec=adapter.Adapter)
     self.sess.get = mock.Mock()
     self.sess.default_microversion = '1'
     self.sess._get_connection = mock.Mock(return_value=self.cloud)
     self.sot = _replication_pair.ReplicationPair()
コード例 #2
0
 def test_replication_pair_update(self):
     replication = _replication_pair.ReplicationPair()
     name = 'name'
     self._verify(
         'openstack.proxy.Proxy._update',
         self.proxy.update_replication_pair,
         method_args=[replication, name],
         expected_args=[_replication_pair.ReplicationPair, replication],
         expected_kwargs={
             'name': name
         }
     )
コード例 #3
0
 def test_replication_pair_expand(self):
     replication = _replication_pair.ReplicationPair(id='replication')
     new_size = 100
     self._verify(
         mock_method='otcextensions.sdk.sdrs.v1.replication_pair.'
                     'ReplicationPair.expand_replication',
         test_method=self.proxy.expand_replication_pair,
         method_args=[replication, new_size],
         expected_args=[self.proxy],
         expected_kwargs={
             'replication': replication.id,
             'new_size': new_size
         }
     )
コード例 #4
0
 def test_detach_replication_pair(self):
     protected_instance = _protected_instance.ProtectedInstance()
     replication = _replication_pair.ReplicationPair()
     self._verify(
         mock_method='otcextensions.sdk.sdrs.v1.protected_instance.'
                     'ProtectedInstance.detach_pair',
         test_method=self.proxy.detach_replication_pair,
         method_args=[protected_instance, replication],
         expected_args=[self.proxy],
         expected_kwargs={
             'protected_instance': protected_instance.id,
             'replication_id': replication.id
         }
     )
コード例 #5
0
 def test_replication_pair_delete(self):
     replication_pair = _replication_pair.ReplicationPair()
     server_group_id = 'server_group_id'
     delete_target_volume = True
     self._verify(
         mock_method='otcextensions.sdk.sdrs.v1.replication_pair.'
                     'ReplicationPair.delete',
         test_method=self.proxy.delete_replication_pair,
         method_args=[replication_pair,
                      server_group_id,
                      delete_target_volume],
         expected_args=[self.proxy],
         expected_kwargs={
             'server_group_id': server_group_id,
             'delete_target_volume': delete_target_volume
         }
     )
コード例 #6
0
 def test_make_it(self):
     test_replication_pair = _replication_pair.ReplicationPair(**EXAMPLE)
     self.assertEqual(EXAMPLE['id'], test_replication_pair.id)
     self.assertEqual(EXAMPLE['name'], test_replication_pair.name)
     self.assertEqual(EXAMPLE['description'],
                      test_replication_pair.description)
     self.assertEqual(EXAMPLE['replication_model'],
                      test_replication_pair.replication_model)
     self.assertEqual(EXAMPLE['status'], test_replication_pair.status)
     self.assertEqual(EXAMPLE['volume_ids'],
                      test_replication_pair.volume_ids)
     self.assertEqual(EXAMPLE['server_group_id'],
                      test_replication_pair.server_group_id)
     self.assertEqual(EXAMPLE['priority_station'],
                      test_replication_pair.priority_station)
     self.assertEqual(EXAMPLE['progress'], test_replication_pair.progress)
     self.assertEqual(EXAMPLE['replication_status'],
                      test_replication_pair.replication_status)
     self.assertEqual(EXAMPLE['fault_level'],
                      test_replication_pair.fault_level)
     self.assertEqual(EXAMPLE['failure_detail'],
                      test_replication_pair.failure_detail)
     self.assertEqual(EXAMPLE['created_at'],
                      test_replication_pair.created_at)
     self.assertEqual(EXAMPLE['updated_at'],
                      test_replication_pair.updated_at)
     self.assertEqual(EXAMPLE['record_metadata']['volume_size'],
                      test_replication_pair.record_metadata.volume_size)
     self.assertEqual(EXAMPLE['record_metadata']['volume_type'],
                      test_replication_pair.record_metadata.volume_type)
     self.assertEqual(EXAMPLE['record_metadata']['multiattach'],
                      test_replication_pair.record_metadata.multiattach)
     self.assertEqual(EXAMPLE['record_metadata']['bootable'],
                      test_replication_pair.record_metadata.bootable)
     self.assertEqual(
         EXAMPLE['attachment'][0]['protected_instance'],
         test_replication_pair.attachment[0].protected_instance)
     self.assertEqual(EXAMPLE['attachment'][0]['device'],
                      test_replication_pair.attachment[0].device)
コード例 #7
0
 def test_basic(self):
     sot = _replication_pair.ReplicationPair()
     self.assertEqual('replication', sot.resource_key)
     self.assertEqual('replications', sot.resources_key)
     self.assertEqual('/replications', sot.base_path)
     self.assertTrue(sot.allow_list)
     self.assertTrue(sot.allow_create)
     self.assertTrue(sot.allow_fetch)
     self.assertTrue(sot.allow_commit)
     self.assertTrue(sot.allow_delete)
     self.assertDictEqual(
         {
             'availability_zone': 'availability_zone',
             'limit': 'limit',
             'marker': 'marker',
             'name': 'name',
             'offset': 'offset',
             'protected_instance_id': 'protected_instance_id',
             'protected_instance_ids': 'protected_instance_ids',
             'query_type': 'query_type',
             'server_group_id': 'server_group_id',
             'server_group_ids': 'server_group_ids',
             'status': 'status'
         }, sot._query_mapping._mapping)