Exemplo n.º 1
0
    def test_absent(self):
        '''
        Test to ensure the Route53 record is deleted.
        '''
        name = 'test.example.com.'
        zone = 'example.com.'
        record_type = 'A'

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

        mock = MagicMock(side_effect=[False, True])
        with patch.dict(boto_route53.__salt__,
                        {'boto_route53.get_record': mock}):
            comt = ('{0} does not exist.'.format(name))
            ret.update({'comment': comt})
            self.assertDictEqual(boto_route53.absent(name, zone, record_type),
                                 ret)

            with patch.dict(boto_route53.__opts__, {'test': True}):
                comt = ('Route53 record {0} set to be deleted.'.format(name))
                ret.update({'comment': comt, 'result': None})
                self.assertDictEqual(boto_route53.absent(name, zone,
                                                         record_type), ret)
Exemplo n.º 2
0
    def test_absent(self):
        """
        Test to ensure the Route53 record is deleted.
        """
        name = "test.example.com."
        zone = "example.com."
        record_type = "A"

        ret = {"name": name, "result": True, "changes": {}, "comment": ""}

        mock = MagicMock(side_effect=[False, True])
        with patch.dict(boto_route53.__salt__, {"boto_route53.get_record": mock}):
            comt = "{0} does not exist.".format(name)
            ret.update({"comment": comt})
            self.assertDictEqual(boto_route53.absent(name, zone, record_type), ret)

            with patch.dict(boto_route53.__opts__, {"test": True}):
                comt = "Route53 record {0} set to be deleted.".format(name)
                ret.update({"comment": comt, "result": None})
                self.assertDictEqual(boto_route53.absent(name, zone, record_type), ret)
def test_absent():
    """
    Test to ensure the Route53 record is deleted.
    """
    name = "test.example.com."
    zone = "example.com."
    record_type = "A"

    ret = {"name": name, "result": True, "changes": {}, "comment": ""}

    mock = MagicMock(side_effect=[False, True])
    with patch.dict(boto_route53.__salt__, {"boto_route53.get_record": mock}):
        comt = "{} does not exist.".format(name)
        ret.update({"comment": comt})
        assert boto_route53.absent(name, zone, record_type) == ret

        with patch.dict(boto_route53.__opts__, {"test": True}):
            comt = "Route53 record {} set to be deleted.".format(name)
            ret.update({"comment": comt, "result": None})
            assert boto_route53.absent(name, zone, record_type) == ret