def test_list_groups(self): ''' Test that list groups returns a list of groups by name ''' groupobj_mock = MagicMock(return_value=[ MockGroupObj('salt', ['WinNT://HOST/steve']), MockGroupObj('salty', ['WinNT://HOST/Administrator']) ]) with patch.object(win_groupadd, '_get_all_groups', groupobj_mock): self.assertListEqual(win_groupadd.list_groups(), ['salt', 'salty'])
def test_list_groups(self): """ Test that list groups returns a list of groups by name """ obj_group_mock = MagicMock(return_value=[ MockGroupObj("salt", ["WinNT://HOST/steve"]), MockGroupObj("salty", ["WinNT://HOST/Administrator"]), ]) with patch.object(win_groupadd, "_get_all_groups", obj_group_mock): self.assertListEqual(win_groupadd.list_groups(), ["salt", "salty"])
def test_list_groups_context(self): ''' Test group.list_groups is using the values in __context__ ''' with patch.dict(win_groupadd.__context__, {'group.list_groups': True}): self.assertTrue(win_groupadd.list_groups())
def test_list_groups_context(self): """ Test group.list_groups is using the values in __context__ """ with patch.dict(win_groupadd.__context__, {"group.list_groups": True}): self.assertTrue(win_groupadd.list_groups())