def test_get_hlu(self): host = UnityHost(cli=t_rest(), _id='Host_10') lun = UnityLun(cli=t_rest(), _id="sv_2") # UnityResourceList will return the found UnityResource # When '_id' as filter. host_lun = UnityHostLunList.get(cli=t_rest(), _id="Host_10_sv_2_prod") assert_that(host_lun, instance_of(UnityHostLun)) hlu = host.get_hlu(lun) assert_that(hlu, equal_to(host_lun.hlu)) # Be caureful, this will return UnityResourceList when 'id' as filter host_lun2 = UnityHostLunList.get(cli=t_rest(), id="Host_10_sv_2_prod") assert_that(host_lun2, instance_of(UnityHostLunList)) assert_that(len(host_lun2), equal_to(1)) assert_that(host_lun, equal_to(host_lun2[0]))
def test_get_hlu_using_object_id_filter(self): host = UnityHost(cli=t_rest(), _id='Host_10') lun = UnityLun(cli=t_rest(), _id="sv_2") filters = {'host.id': host.id, 'lun.id': lun.id} host_lun = UnityHostLunList.get(cli=t_rest(), **filters) assert_that(host_lun, instance_of(UnityHostLunList)) assert_that(len(host_lun), equal_to(1)) hlu = host.get_hlu(lun) assert_that(hlu, equal_to(host_lun[0].hlu))
def test_get_hlu(self): host = UnityHost(cli=t_rest(), _id='Host_10') lun = UnityLun(cli=t_rest(), _id="sv_2") host_lun = UnityHostLunList.get(_id="Host_10_sv_2_prod", cli=t_rest()) hlu = host.get_hlu(lun) assert_that(hlu, equal_to(host_lun.hlu))