Exemple #1
0
    def test_parse_caa_iodef(self):
        caa_record = objects.CAA()
        caa_record._from_string('0 iodef https://example.net/')

        self.assertEqual(0, caa_record.flags)
        self.assertEqual('iodef https://example.net/', caa_record.prpt)

        caa_record = objects.CAA()
        caa_record._from_string('0 iodef mailto:[email protected]')

        self.assertEqual(0, caa_record.flags)
        self.assertEqual('iodef mailto:[email protected]', caa_record.prpt)
Exemple #2
0
    def test_parse_caa_issuewild(self):
        caa_record = objects.CAA()
        caa_record._from_string('1 issuewild ca.example.net; policy=ev')

        self.assertEqual(1, caa_record.flags)
        self.assertEqual('issuewild ca.example.net; policy=ev',
                         caa_record.prpt)
Exemple #3
0
 def test_parse_caa_iodef_http_host_too_long(self):
     hostname = 'a' * 64
     caa_record = objects.CAA()
     self.assertRaisesRegex(
         ValueError,
         'Host aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
         'aaaaaaaaaa is too long', caa_record._from_string,
         '0 iodef https://%s.net/' % hostname)
Exemple #4
0
 def test_parse_caa_iodef_mail_domain_not_valid(self):
     caa_record = objects.CAA()
     self.assertRaisesRegex(ValueError,
                            'Domain example.net. does not match',
                            caa_record._from_string,
                            '0 iodef mailto:[email protected].')
Exemple #5
0
 def test_parse_caa_issue_key_value_not_valid(self):
     caa_record = objects.CAA()
     self.assertRaisesRegex(ValueError, 'def is not valid key-value pair',
                            caa_record._from_string, '0 issue abc;def')
Exemple #6
0
 def test_parse_caa_issue_domain_not_valid(self):
     caa_record = objects.CAA()
     self.assertRaisesRegex(ValueError, 'Domain abc. does not match',
                            caa_record._from_string, '0 issue abc.')
Exemple #7
0
 def test_parse_caa_invalid(self):
     caa_record = objects.CAA()
     self.assertRaisesRegex(
         ValueError,
         "Property tag 1 2 must be 'issue', 'issuewild' or 'iodef'",
         caa_record._from_string, '0 1 2')
Exemple #8
0
    def test_parse_caa_issue(self):
        caa_record = objects.CAA()
        caa_record._from_string('0 issue ca.example.net')

        self.assertEqual(0, caa_record.flags)
        self.assertEqual('issue ca.example.net', caa_record.prpt)
Exemple #9
0
 def test_parse_caa_iodef_not_valid_url(self):
     caa_record = objects.CAA()
     self.assertRaisesRegex(ValueError, 'https:// is not valid URL',
                            caa_record._from_string, '0 iodef https://')