NSXv3: Fix NSGroupManager initialization test
Change-Id: Ie5d54c8e51ca2dafa7b6167a73629ca6a56b0a1a
This commit is contained in:
parent
0fffc58ac8
commit
6b6237338a
@ -289,22 +289,22 @@ class TestNSGroupManager(nsxlib_testcase.NsxLibTestCase):
|
|||||||
@_mock_create_and_list_nsgroups
|
@_mock_create_and_list_nsgroups
|
||||||
@mock.patch('vmware_nsx.nsxlib.v3.security.NsxLibNsGroup.remove_member')
|
@mock.patch('vmware_nsx.nsxlib.v3.security.NsxLibNsGroup.remove_member')
|
||||||
@mock.patch('vmware_nsx.nsxlib.v3.security.NsxLibNsGroup.add_members')
|
@mock.patch('vmware_nsx.nsxlib.v3.security.NsxLibNsGroup.add_members')
|
||||||
def initialize_with_absent_nested_groups(self,
|
def test_initialize_with_absent_nested_groups(self,
|
||||||
add_member_mock,
|
add_member_mock,
|
||||||
remove_member_mock):
|
remove_member_mock):
|
||||||
size = 3
|
size = 3
|
||||||
cont_manager = ns_group_manager.NSGroupManager(self.nsxlib, size)
|
cont_manager = ns_group_manager.NSGroupManager(self.nsxlib, size)
|
||||||
# list_nsgroups will return nested group 1 and 3, but not group 2.
|
# list_nsgroups will return nested group 1 and 3, but not group 2.
|
||||||
# FIXME: Not sure what this mock does. no one calls this method now.
|
nsgroups = cont_manager.nsxlib_nsgroup.list()
|
||||||
#with mock.patch.object(vmware_nsx.nsxlib.v3.NsxLib.list_nsgroups,
|
with mock.patch("vmware_nsx.nsxlib.v3.security.NsxLibNsGroup.list",
|
||||||
# 'list_nsgroups_mock') as list_nsgroups_mock:
|
side_effect=lambda: nsgroups[::2]):
|
||||||
# list_nsgroups_mock = lambda: list_nsgroups_mock()[::2]
|
# invoking the initialization process again, it should process
|
||||||
# invoking the initialization process again, it should process
|
# groups 1 and 3 and create group 2.
|
||||||
# groups 1 and 3 and create group 2.
|
cont_manager = ns_group_manager.NSGroupManager(self.nsxlib, size)
|
||||||
self.assertEqual({1: NSG_IDS[0],
|
self.assertEqual({0: NSG_IDS[0],
|
||||||
2: NSG_IDS[3],
|
1: NSG_IDS[3],
|
||||||
3: NSG_IDS[2]},
|
2: NSG_IDS[2]},
|
||||||
cont_manager.nested_groups)
|
cont_manager.nested_groups)
|
||||||
|
|
||||||
@_mock_create_and_list_nsgroups
|
@_mock_create_and_list_nsgroups
|
||||||
def test_suggest_nested_group(self):
|
def test_suggest_nested_group(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user