def test_present_absent(docker_cmd_run_all_wrapper): """ Test rabbitmq_vhost.present """ # Clear the user ret = rabbitmq_vhost.present("vhost") expected = { "name": "vhost", "result": True, "comment": 'Adding vhost "vhost" ...\n', "changes": {"old": "", "new": "vhost"}, } assert ret == expected # Delete the user ret = rabbitmq_vhost.absent("vhost") expected = { "name": "vhost", "result": True, "comment": 'Deleting vhost "vhost" ...\n', "changes": {"old": "vhost", "new": ""}, } assert ret == expected
def test_absent(docker_cmd_run_all_wrapper): """ Test rabbitmq_vhost.present """ # Delete the user ret = rabbitmq_vhost.absent("vhost") expected = { "name": "vhost", "result": True, "comment": "Virtual Host 'vhost' is not present.", "changes": {}, } assert ret == expected
def test_absent(self): ''' Test to ensure the named user is absent. ''' name = 'myqueue' ret = {'name': name, 'changes': {}, 'result': True, 'comment': 'Virtual Host \'{0}\' is not present.'.format(name)} mock = MagicMock(return_value=False) with patch.dict(rabbitmq_vhost.__salt__, {'rabbitmq.vhost_exists': mock}): self.assertDictEqual(rabbitmq_vhost.absent(name), ret)
def test_absent(): """ Test to ensure the named user is absent. """ name = "myqueue" ret = { "name": name, "changes": {}, "result": True, "comment": "Virtual Host '{}' is not present.".format(name), } mock = MagicMock(return_value=False) with patch.dict(rabbitmq_vhost.__salt__, {"rabbitmq.vhost_exists": mock}): assert rabbitmq_vhost.absent(name) == ret
def test_absent(self): ''' Test to ensure the named user is absent. ''' name = 'myqueue' ret = { 'name': name, 'changes': {}, 'result': True, 'comment': 'Virtual Host \'{0}\' is not present.'.format(name) } mock = MagicMock(return_value=False) with patch.dict(rabbitmq_vhost.__salt__, {'rabbitmq.vhost_exists': mock}): self.assertDictEqual(rabbitmq_vhost.absent(name), ret)