def test_absent(self):
        name = 'frank'

        ret = {'name': name,
               'changes': {},
               'result': False,
               'comment': ''}

        mock_t = MagicMock(side_effect=[True, False])
        mock = MagicMock(side_effect=[True, True, True, False])
        with patch.dict(postgres_extension.__salt__,
                        {'postgres.is_installed_extension': mock,
                         'postgres.drop_extension': mock_t}):
            with patch.dict(postgres_extension.__opts__, {'test': True}):
                comt = ('Extension {0} is set to be removed'.format(name))
                ret.update({'comment': comt, 'result': None})
                self.assertDictEqual(postgres_extension.absent(name), ret)

            with patch.dict(postgres_extension.__opts__, {'test': False}):
                comt = ('Extension {0} has been removed'.format(name))
                ret.update({'comment': comt, 'result': True,
                            'changes': {name: 'Absent'}})
                self.assertDictEqual(postgres_extension.absent(name), ret)

                comt = ('Extension {0} failed to be removed'.format(name))
                ret.update({'comment': comt, 'result': False, 'changes': {}})
                self.assertDictEqual(postgres_extension.absent(name), ret)

            comt = ('Extension {0} is not present, so it cannot be removed'
                    .format(name))
            ret.update({'comment': comt, 'result': True})
            self.assertDictEqual(postgres_extension.absent(name), ret)
Test to ensure that the named extension is absent.
dataset/ETHPy150Open saltstack/salt/tests/unit/states/postgres_extension_test.py/PostgresExtensionTestCase.test_absent