def test_modify_read_write_hosts(self): share = UnityNfsShare(cli=t_rest(), _id='NFSShare_5') resp = share.modify(read_write_hosts=['Host_7']) assert_that(resp.is_ok(), equal_to(True)) share.update() assert_that(share.read_write_hosts, instance_of(UnityHostList)) assert_that(share.read_write_hosts[0].get_id(), equal_to('Host_7'))
def test_host_access_properties(self): nfs = UnityNfsShare('NFSShare_5', cli=t_rest()) assert_that(nfs.read_write_hosts, only_contains(host('Host_7'))) assert_that(nfs.read_only_hosts, none()) assert_that(nfs.root_access_hosts, none()) assert_that(nfs.no_access_hosts, none())
def test_snap_based_share_properties(self): share = UnityNfsShare.get(t_rest(), _id='NFSShare_2') assert_that(share.type, equal_to(NFSTypeEnum.NFS_SNAPSHOT)) assert_that(share.filesystem, instance_of(UnityFileSystem)) assert_that(share.snap, instance_of(UnitySnap))
def test_add_read_write_snap_share(self): share = UnityNfsShare(cli=t_rest(), _id='NFSShare_30') resp = share.allow_read_write_access('2.2.2.2', True) assert_that(resp.is_ok(), equal_to(True))
def test_delete_access_host_not_found(self): share = UnityNfsShare(cli=t_rest(), _id='NFSShare_4') resp = share.delete_access(['Host_99']) assert_that(resp.is_ok(), equal_to(True))
def test_delete_access_success(self): share = UnityNfsShare(cli=t_rest(), _id='NFSShare_7') resp = share.delete_access(['Host_1', 'Host_14', 'Host_15']) assert_that(resp.is_ok(), equal_to(True))
def test_add_ip_access_existed(self): share = UnityNfsShare(cli=t_rest(), _id='NFSShare_5') h1 = UnityHost(_id='Host_1', cli=t_rest()) resp = share.allow_read_only_access([h1, '1.1.1.1'], force_create_host=True) assert_that(resp.is_ok(), equal_to(True))
def test_delete_snap_based_share(self): share = UnityNfsShare(cli=t_rest(), _id='NFSShare_11') resp = share.delete() assert_that(resp.is_ok(), equal_to(True))
def test_modify_multiple_hosts(self): share = UnityNfsShare(cli=t_rest(), _id='NFSShare_5') host7 = UnityHost(_id='Host_7', cli=t_rest()) resp = share.modify(read_only_hosts=host7, read_write_hosts=['Host_1', 'Host_2']) assert_that(resp.is_ok(), equal_to(True))
def test_delete_nfs_share_async(self): share = UnityNfsShare(_id='NFSShare_6', cli=t_rest()) resp = share.delete(async=True) job = resp.job assert_that(job.existed, equal_to(True)) assert_that(str(job.est_remain_time), equal_to('0:00:01'))
def f(): share = UnityNfsShare(_id='NFSShare_31', cli=t_rest()) share.create_snap('share_snap')
def f(): UnityNfsShare.create(t_rest(), 'ns1', 'fs_9', share_access=NFSShareDefaultAccessEnum.ROOT)
def f(): share = UnityNfsShare(cli=t_rest(), _id='NFSShare_7') share.delete_access(['9.9.9.9'])
def test_delete_nfs_share_success(self): share = UnityNfsShare(_id='NFSShare_4', cli=t_rest()) resp = share.delete() assert_that(resp.is_ok(), equal_to(True))
def test_clear_access(self): share = UnityNfsShare(cli=t_rest(), _id='NFSShare_7') resp = share.clear_access() assert_that(resp.is_ok(), equal_to(True))
def test_share_in_tenant_allow_access_to_ip(self): share = UnityNfsShare(_id='NFSShare_32', cli=t_rest()) resp = share.allow_read_only_access('192.168.112.23') assert_that(resp.is_ok(), equal_to(True))
def test_delete_access_snap_share(self): share = UnityNfsShare(cli=t_rest(), _id='NFSShare_31') resp = share.delete_access(['1.1.1.1', '1.1.1.3']) assert_that(resp.is_ok(), equal_to(True))
def f(): UnityNfsShare.create(t_rest(), 'ns1', 'fs_8')
def test_tenant_properties(self): nfs = UnityNfsShare('NFSShare_32', cli=t_rest()) assert_that(nfs.tenant.id, equal_to('tenant_1'))
def test_create_nfs_share_success(self): share = UnityNfsShare.create( t_rest(), 'ns1', 'fs_9', share_access=NFSShareDefaultAccessEnum.READ_WRITE) assert_that(share.name, equal_to('ns1')) assert_that(share.id, equal_to('NFSShare_4'))
def f(): UnityNfsShare.create( t_rest(), 'ns1', 'fs_9', share_access=NFSShareDefaultAccessEnum.ROOT)
def test_delete_nfs_share_async(self): share = UnityNfsShare(_id='NFSShare_6', cli=t_rest()) resp = share.delete(async_mode=True) job = resp.job assert_that(job.existed, equal_to(True)) assert_that(str(job.est_remain_time), equal_to('0:00:01'))
def test_modify_snap_nfs_share_no_param(self): share = UnityNfsShare(cli=t_rest(), _id='SMBShare_52') share.modify()
def test_ip_list_of_host_list(self): share = UnityNfsShare(cli=t_rest(), _id='NFSShare_31') assert_that(share.read_write_hosts.ip_list, only_contains('1.1.1.1')) assert_that(share.read_only_hosts.ip_list, equal_to([])) assert_that(share.root_access_hosts, none())