def test_sync_group_already_promoted(self):
     mg1 = VNXMirrorGroup.get(t_cli(), name='mg_promote_on_primary')
     assert_that(mg1.sync_group, raises(VNXMirrorGroupAlreadyPromotedError))
 def test_promote_group(self):
     mg1 = VNXMirrorGroupAsync.get(t_cli(), name='petermg2')
     mg1.promote_group()
 def test_add_to_group(self):
     mirror = VNXMirrorViewAsync.get(t_cli(), name='testdr_004')
     mg1 = VNXMirrorGroupAsync.get(t_cli(), name='petermg1')
     mg1.add_mirror(mirror)
 def test_create(self):
     mg = VNXMirrorGroupAsync.create(t_cli(), name='test_group')
     assert_that(mg, instance_of(VNXMirrorGroupAsync))
 def test_create_and_add(self):
     mirror = VNXMirrorViewAsync.get(t_cli(), name='testdr_004')
     mg = VNXMirrorGroupAsync.create(t_cli(),
                                     name='petermg1',
                                     mirror=mirror)
     assert_that(mg, instance_of(VNXMirrorGroupAsync))
 def f():
     mv = VNXMirrorViewAsync.get(t_cli(), 'testdr_005')
     mv.promote_image()
 def f():
     mv = VNXMirrorViewAsync.get(t_cli(), 'testdr_005')
     mv.delete()
 def test_get_all(self):
     mv_list = VNXMirrorView.get(t_cli())
     assert_that(len(mv_list), equal_to(4))
 def test_add_image_success(self):
     mv = VNXMirrorViewAsync.get(t_cli(), 'testdr_005')
     mv.add_image('192.168.1.94', 71)
     assert_that(len(mv.images), equal_to(2))
 def f():
     VNXMirrorViewAsync.create(t_cli(), 'mv0', 244)
 def f():
     VNXMirrorViewAsync.create(t_cli(), 'testdr_003', 72)
 def test_create_success(self):
     mv = VNXMirrorViewAsync.create(t_cli(), 'testdr_003', 71)
     assert_that(mv.name, equal_to('testdr_003'))
 def test_image_properties(self):
     mv = VNXMirrorViewAsync.get(t_cli(), 'testdr_001')
     assert_that(mv.is_primary, equal_to(True))
     assert_that(mv.primary_image.is_primary, equal_to(True))
     assert_that(mv.secondary_image.is_primary, equal_to(False))
 def test_delete_group(self):
     mg1 = VNXMirrorGroup.get(t_cli(), name='petermg')
     mg1.delete()
 def test_fracture_image_success(self):
     mv = VNXMirrorViewAsync.get(t_cli(), 'testdr_005')
     # no error raised
     mv.fracture_image()
 def f():
     mv = VNXMirrorViewAsync.get(t_cli(), 'testdr_005')
     mv.add_image('192.168.1.94', 72)
 def f():
     mv = VNXMirrorViewAsync.get(t_cli(), 'testdr_005')
     mv.promote_image('50:06:01:60:88:60:05:FF')
 def test_get_image_found(self):
     mv = VNXMirrorViewAsync.get(t_cli(), 'testdr_004')
     image = mv.get_image('50:06:01:60:B6:60:23:7E')
     assert_that(image.state, equal_to(VNXMirrorImageState.SYNCHRONIZED))
 def f():
     mv = VNXMirrorViewAsync.get(t_cli(), 'mv8')
     mv.delete()
 def f():
     mv = VNXMirrorViewAsync.get(t_cli(), 'testdr_004')
     mv.remove_image('50:06:01:60:88:60:05:FF')
 def test_force_delete_mirror_has_secondary(self):
     mv = VNXMirrorViewAsync.get(t_cli(), 'testdr_006')
     # no error raised
     mv.delete(force=True)
 def test_remove_image_success(self):
     mv = VNXMirrorViewAsync.get(t_cli(), 'testdr_004')
     # no error raised
     mv.remove_image()
 def _inner():
     VNXMirrorGroupAsync.create(t_cli(), name='test_group_in_use')
 def f():
     mv = VNXMirrorViewAsync.get(t_cli(), 'testdr_003')
     mv.remove_image()
 def test_get_all(self):
     mg_list = VNXMirrorGroupAsync.get(t_cli())
     assert_that(len(mg_list), equal_to(2))
     assert_that(mg_list, instance_of(VNXMirrorGroupAsyncList))
    def test_mirror_view_not_installed(self):
        mv_list = VNXMirrorView.get(t_cli())
        assert_that(len(mv_list), equal_to(0))

        mv = VNXMirrorView.get(t_cli(), 'mv_sync_2')
        assert_that(mv.existed, equal_to(False))
 def test_fracture_group(self):
     mg1 = VNXMirrorGroupAsync.get(t_cli(), name='petermg1')
     mg1.fracture_group()
 def f():
     mv = VNXMirrorViewAsync.get(t_cli(), 'testdr_005')
     mv.fracture_image('50:06:01:60:B6:60:23:8F')
 def test_remove_from_group(self):
     mirror = VNXMirrorGroupAsync.get(t_cli(), name='testdr_004')
     mg1 = VNXMirrorGroupAsync.get(t_cli(), name='petermg1')
     mg1.remove_mirror(mirror)
 def test_sync_group(self):
     mg1 = VNXMirrorGroup.get(t_cli(), name='petermg')
     mg1.sync_group()