

def test_absent(self):
    '\n            Test to ensure that the named group is absent\n        '
    ret = {
        'name': 'salt',
        'changes': {
            
        },
        'result': True,
        'comment': {
            
        },
    }
    mock = MagicMock(side_effect=[True, True, True, False])
    with patch.dict(group.__salt__, {
        'group.info': mock,
    }):
        with patch.dict(group.__opts__, {
            'test': True,
        }):
            ret.update({
                'result': None,
                'comment': 'Group salt is set for removal',
            })
            self.assertDictEqual(group.absent('salt'), ret)
        with patch.dict(group.__opts__, {
            'test': False,
        }):
            mock = MagicMock(side_effect=[True, False])
            with patch.dict(group.__salt__, {
                'group.delete': mock,
            }):
                mock.update({
                    'result': True,
                    'changes': {
                        'salt': '',
                    },
                    'comment': 'Removed group salt',
                })
                self.assertDictEqual(group.absent('salt'), ret)
                ret.update({
                    'changes': {
                        
                    },
                    'result': False,
                    'comment': 'Failed to remove group salt',
                })
                self.assertDictEqual(group.absent('salt'), ret)
        ret.update({
            'result': True,
            'comment': 'Group not present',
        })
        self.assertDictEqual(group.absent('salt'), ret)

dataset/ETHPy150Open saltstack/salt/tests/unit/states/group_test.py GroupTestCase.test_absent/VarMisuse@192/275 `ret`->`mock`