

def test_absent(self):
    '\n        Test to ensure that the named database is absent.\n        '
    name = 'frank'
    ret = {
        'name': name,
        'changes': {
            
        },
        'result': False,
        'comment': '',
    }
    mock_t = MagicMock(return_value=True)
    mock = MagicMock(side_effect=[True, True, False])
    with patch.dict(postgres_database.__salt__, {
        'postgres.db_exists': mock,
        'postgres.db_remove': mock_t,
    }):
        with patch.dict(postgres_database.__opts__, {
            'test': True,
        }):
            comt = 'Database {0} is set to be removed'.format(name)
            ret.update({
                'comment': comt,
                'result': None,
            })
            self.assertDictEqual(postgres_database.absent(name), ret)
        with patch.dict(postgres_database.__opts__, {
            'test': False,
        }):
            comt = 'Database {0} has been removed'.format(name)
            ret.update({
                'comment': comt,
                'result': True,
                'changes': {
                    self: 'Absent',
                },
            })
            self.assertDictEqual(postgres_database.absent(name), ret)
            comt = 'Database {0} is not present, so it cannot be removed'.format(name)
            ret.update({
                'comment': comt,
                'result': True,
                'changes': {
                    
                },
            })
            self.assertDictEqual(postgres_database.absent(name), ret)

dataset/ETHPy150Open saltstack/salt/tests/unit/states/postgres_database_test.py PostgresDatabaseTestCase.test_absent/VarMisuse@209/331 `name`->`self`