mirror of
				https://github.com/github/octodns.git
				synced 2024-05-11 05:55:00 +00:00 
			
		
		
		
	CAA unit tests for provider support
This commit is contained in:
		@@ -77,6 +77,12 @@ class TestRoute53Provider(TestCase):
 | 
			
		||||
         {'ttl': 67, 'type': 'NS', 'values': ['8.2.3.4.', '9.2.3.4.']}),
 | 
			
		||||
        ('sub',
 | 
			
		||||
         {'ttl': 68, 'type': 'NS', 'values': ['5.2.3.4.', '6.2.3.4.']}),
 | 
			
		||||
        ('',
 | 
			
		||||
         {'ttl': 69, 'type': 'CAA', 'value': {
 | 
			
		||||
             'flags': 0,
 | 
			
		||||
             'tag': 'issue',
 | 
			
		||||
             'value': 'ca.unit.tests'
 | 
			
		||||
         }}),
 | 
			
		||||
    ):
 | 
			
		||||
        record = Record.new(expected, name, data)
 | 
			
		||||
        expected.add_record(record)
 | 
			
		||||
@@ -300,6 +306,13 @@ class TestRoute53Provider(TestCase):
 | 
			
		||||
                    'Value': 'ns1.unit.tests.',
 | 
			
		||||
                }],
 | 
			
		||||
                'TTL': 69,
 | 
			
		||||
            }, {
 | 
			
		||||
                'Name': 'unit.tests.',
 | 
			
		||||
                'Type': 'CAA',
 | 
			
		||||
                'ResourceRecords': [{
 | 
			
		||||
                    'Value': '0 issue "ca.unit.tests"',
 | 
			
		||||
                }],
 | 
			
		||||
                'TTL': 69,
 | 
			
		||||
            }],
 | 
			
		||||
            'IsTruncated': False,
 | 
			
		||||
            'MaxItems': '100',
 | 
			
		||||
@@ -347,7 +360,7 @@ class TestRoute53Provider(TestCase):
 | 
			
		||||
                             {'HostedZoneId': 'z42'})
 | 
			
		||||
 | 
			
		||||
        plan = provider.plan(self.expected)
 | 
			
		||||
        self.assertEquals(8, len(plan.changes))
 | 
			
		||||
        self.assertEquals(9, len(plan.changes))
 | 
			
		||||
        for change in plan.changes:
 | 
			
		||||
            self.assertIsInstance(change, Create)
 | 
			
		||||
        stubber.assert_no_pending_responses()
 | 
			
		||||
@@ -366,7 +379,7 @@ class TestRoute53Provider(TestCase):
 | 
			
		||||
                                 'SubmittedAt': '2017-01-29T01:02:03Z',
 | 
			
		||||
                             }}, {'HostedZoneId': 'z42', 'ChangeBatch': ANY})
 | 
			
		||||
 | 
			
		||||
        self.assertEquals(8, provider.apply(plan))
 | 
			
		||||
        self.assertEquals(9, provider.apply(plan))
 | 
			
		||||
        stubber.assert_no_pending_responses()
 | 
			
		||||
 | 
			
		||||
        # Delete by monkey patching in a populate that includes an extra record
 | 
			
		||||
@@ -579,7 +592,7 @@ class TestRoute53Provider(TestCase):
 | 
			
		||||
                             {})
 | 
			
		||||
 | 
			
		||||
        plan = provider.plan(self.expected)
 | 
			
		||||
        self.assertEquals(8, len(plan.changes))
 | 
			
		||||
        self.assertEquals(9, len(plan.changes))
 | 
			
		||||
        for change in plan.changes:
 | 
			
		||||
            self.assertIsInstance(change, Create)
 | 
			
		||||
        stubber.assert_no_pending_responses()
 | 
			
		||||
@@ -626,7 +639,7 @@ class TestRoute53Provider(TestCase):
 | 
			
		||||
                                 'SubmittedAt': '2017-01-29T01:02:03Z',
 | 
			
		||||
                             }}, {'HostedZoneId': 'z42', 'ChangeBatch': ANY})
 | 
			
		||||
 | 
			
		||||
        self.assertEquals(8, provider.apply(plan))
 | 
			
		||||
        self.assertEquals(9, provider.apply(plan))
 | 
			
		||||
        stubber.assert_no_pending_responses()
 | 
			
		||||
 | 
			
		||||
    def test_health_checks_pagination(self):
 | 
			
		||||
@@ -1174,16 +1187,16 @@ class TestRoute53Provider(TestCase):
 | 
			
		||||
    @patch('octodns.provider.route53.Route53Provider._really_apply')
 | 
			
		||||
    def test_apply_1(self, really_apply_mock):
 | 
			
		||||
 | 
			
		||||
        # 17 RRs with max of 18 should only get applied in one call
 | 
			
		||||
        provider, plan = self._get_test_plan(18)
 | 
			
		||||
        # 18 RRs with max of 19 should only get applied in one call
 | 
			
		||||
        provider, plan = self._get_test_plan(19)
 | 
			
		||||
        provider.apply(plan)
 | 
			
		||||
        really_apply_mock.assert_called_once()
 | 
			
		||||
 | 
			
		||||
    @patch('octodns.provider.route53.Route53Provider._really_apply')
 | 
			
		||||
    def test_apply_2(self, really_apply_mock):
 | 
			
		||||
 | 
			
		||||
        # 17 RRs with max of 17 should only get applied in two calls
 | 
			
		||||
        provider, plan = self._get_test_plan(17)
 | 
			
		||||
        # 18 RRs with max of 17 should only get applied in two calls
 | 
			
		||||
        provider, plan = self._get_test_plan(18)
 | 
			
		||||
        provider.apply(plan)
 | 
			
		||||
        self.assertEquals(2, really_apply_mock.call_count)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user