egberts / bind9_parser

Bind9 Parser in Python that can process all of ISC Bind configuration files
MIT License
22 stars 7 forks source link

test_clause_trusted_keys.py failed #18

Closed egberts closed 2 years ago

egberts commented 2 years ago

FAILED (errors=2) ERR_COUNT: 6 FAILED_MODULES: , test_clauses, test_clause_trusted_keys, test_clause_view, test_options, test_optviewzone, test_zone

egberts commented 2 years ago
$ python3 -munittest tests/test_clause_trusted_keys.py 
Match trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; at loc 0(1,1)
Matched trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; -> [['test.example', '256', '3', '8', 'ABCDEFG']]
Good result:
{ 'trusted_keys': [ { 'algorithm_id': '8',
                      'domain': 'test.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'}]}
expecting: 
{ 'trusted_keys': [ { 'algorithm_id': '8',
                      'domain': 'test.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'}]}
assert(True)
.   Match trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; at loc 0(1,1)
    Matched trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; -> [['test.example', '256', '3', '8', 'ABCDEFG']]
Good result:
{ 'trusted_keys': [ { 'algorithm_id': '8',
                      'domain': 'test.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'}]}
expecting: 
{ 'trusted_keys': [ { 'algorithm_id': '8',
                      'domain': 'test.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'}]}
assert(True)
.           Match trusted-keys { ... }; [ trusted-keys { ... }; ... ] at loc 0(1,1)
                            Match trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; at loc 1(2,1)
                            Matched trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; -> [['test10.example', '256', '3', '8', 'ABCDEFG'], ['test12.example', '257', '3', '10', 'ABCDEFG'], ['test13.example', '256', '3', '13', 'ABC+DEFG'], ['test14.example', '257', '3', '14', 'ABC/DEFGasdfasddfasddf'], ['test15.example', '256', '3', '15', 'ABC/DEFGasdfasddfasddf']]
                            Match trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; at loc 247(8,7)
                            Matched trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; -> [['test20.example', '256', '3', '8', 'ABCDEFG'], ['test22.example', '257', '3', '10', 'ABCDEFG'], ['test23.example', '256', '3', '13', 'ABC+DEFG'], ['test24.example', '257', '3', '14', 'ABC/DEFGasdfasddfasddf'], ['test25.example', '256', '3', '15', 'ABC/DEFGasdfasddfasddf']]
                            Match trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; at loc 494(15,7)
                            Matched trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; -> [['test30.example', '256', '3', '8', 'ABCDEFG'], ['test32.example', '257', '3', '10', 'ABCDEFG'], ['test33.example', '256', '3', '13', 'ABC+DEFG'], ['test34.example', '257', '3', '14', 'ABC/DEFGasdfasddfasddf'], ['test35.example', '256', '3', '15', 'ABC/DEFGasdfasddfasddf']]
                            Match trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; at loc 741(22,7)
                                        Exception raised:Expected "trusted-keys", found end of text  (at char 742), (line:23, col:1)
                                        Matched trusted-keys { ... }; [ trusted-keys { ... }; ... ] -> [['test10.example', '256', '3', '8', 'ABCDEFG'], ['test12.example', '257', '3', '10', 'ABCDEFG'], ['test13.example', '256', '3', '13', 'ABC+DEFG'], ['test14.example', '257', '3', '14', 'ABC/DEFGasdfasddfasddf'], ['test15.example', '256', '3', '15', 'ABC/DEFGasdfasddfasddf'], ['test20.example', '256', '3', '8', 'ABCDEFG'], ['test22.example', '257', '3', '10', 'ABCDEFG'], ['test23.example', '256', '3', '13', 'ABC+DEFG'], ['test24.example', '257', '3', '14', 'ABC/DEFGasdfasddfasddf'], ['test25.example', '256', '3', '15', 'ABC/DEFGasdfasddfasddf'], ['test30.example', '256', '3', '8', 'ABCDEFG'], ['test32.example', '257', '3', '10', 'ABCDEFG'], ['test33.example', '256', '3', '13', 'ABC+DEFG'], ['test34.example', '257', '3', '14', 'ABC/DEFGasdfasddfasddf'], ['test35.example', '256', '3', '15', 'ABC/DEFGasdfasddfasddf']]
Good result:
{ 'trusted_keys': [ { 'algorithm_id': '8',
                      'domain': 'test10.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'},
                    { 'algorithm_id': '10',
                      'domain': 'test12.example',
                      'key_id': '257',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'},
                    { 'algorithm_id': '13',
                      'domain': 'test13.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC+DEFG'},
                    { 'algorithm_id': '14',
                      'domain': 'test14.example',
                      'key_id': '257',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC/DEFGasdfasddfasddf'},
                    { 'algorithm_id': '15',
                      'domain': 'test15.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC/DEFGasdfasddfasddf'},
                    { 'algorithm_id': '8',
                      'domain': 'test20.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'},
                    { 'algorithm_id': '10',
                      'domain': 'test22.example',
                      'key_id': '257',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'},
                    { 'algorithm_id': '13',
                      'domain': 'test23.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC+DEFG'},
                    { 'algorithm_id': '14',
                      'domain': 'test24.example',
                      'key_id': '257',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC/DEFGasdfasddfasddf'},
                    { 'algorithm_id': '15',
                      'domain': 'test25.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC/DEFGasdfasddfasddf'},
                    { 'algorithm_id': '8',
                      'domain': 'test30.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'},
                    { 'algorithm_id': '10',
                      'domain': 'test32.example',
                      'key_id': '257',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'},
                    { 'algorithm_id': '13',
                      'domain': 'test33.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC+DEFG'},
                    { 'algorithm_id': '14',
                      'domain': 'test34.example',
                      'key_id': '257',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC/DEFGasdfasddfasddf'},
                    { 'algorithm_id': '15',
                      'domain': 'test35.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC/DEFGasdfasddfasddf'}]}
expecting: 
{ 'trusted_keys': [ { 'algorithm_id': '8',
                      'domain': 'test10.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'},
                    { 'algorithm_id': '10',
                      'domain': 'test12.example',
                      'key_id': '257',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'},
                    { 'algorithm_id': '13',
                      'domain': 'test13.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC+DEFG'},
                    { 'algorithm_id': '14',
                      'domain': 'test14.example',
                      'key_id': '257',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC/DEFGasdfasddfasddf'},
                    { 'algorithm_id': '15',
                      'domain': 'test15.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC/DEFGasdfasddfasddf'},
                    { 'algorithm_id': '8',
                      'domain': 'test20.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'},
                    { 'algorithm_id': '10',
                      'domain': 'test22.example',
                      'key_id': '257',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'},
                    { 'algorithm_id': '13',
                      'domain': 'test23.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC+DEFG'},
                    { 'algorithm_id': '14',
                      'domain': 'test24.example',
                      'key_id': '257',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC/DEFGasdfasddfasddf'},
                    { 'algorithm_id': '15',
                      'domain': 'test25.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC/DEFGasdfasddfasddf'},
                    { 'algorithm_id': '8',
                      'domain': 'test30.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'},
                    { 'algorithm_id': '10',
                      'domain': 'test32.example',
                      'key_id': '257',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'},
                    { 'algorithm_id': '13',
                      'domain': 'test33.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC+DEFG'},
                    { 'algorithm_id': '14',
                      'domain': 'test34.example',
                      'key_id': '257',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC/DEFGasdfasddfasddf'},
                    { 'algorithm_id': '15',
                      'domain': 'test35.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABC/DEFGasdfasddfasddf'}]}
assert(True)
.                                       Match trusted-keys { ... }; [ trusted-keys { ... }; ... ] at loc 0(1,1)
                                        Match trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; at loc 1(2,1)
                                        Matched trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; -> [['test.example', '256', '3', '8', 'ABCDEFG']]
                                        Match trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; at loc 58(4,7)
                                        Matched trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; -> [['test.example', '257', '3', '10', 'ABCDEFG']]
                                        Match trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; at loc 117(7,7)
                                        Matched trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; -> [['test.example', '256', '3', '13', 'ABCDEFG']]
                                        Match trusted-keys { 
        string ( 
            static-key |
            initial-key | 
            static-ds |
            initial-ds )
        <flags> <protocol_type> <algorithm_id>
        <quoted_base64_string>; 
        ... }; at loc 176(10,7)
                                        Exception raised:Expected "trusted-keys", found end of text  (at char 177), (line:11, col:1)
                                        Matched trusted-keys { ... }; [ trusted-keys { ... }; ... ] -> [['test.example', '256', '3', '8', 'ABCDEFG'], ['test.example', '257', '3', '10', 'ABCDEFG'], ['test.example', '256', '3', '13', 'ABCDEFG']]
Good result:
{ 'trusted_keys': [ { 'algorithm_id': '8',
                      'domain': 'test.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'},
                    { 'algorithm_id': '10',
                      'domain': 'test.example',
                      'key_id': '257',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'},
                    { 'algorithm_id': '13',
                      'domain': 'test.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'}]}
expecting: 
{ 'trusted_keys': [ { 'algorithm_id': '8',
                      'domain': 'test.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'},
                    { 'algorithm_id': '10',
                      'domain': 'test.example',
                      'key_id': '257',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'},
                    { 'algorithm_id': '13',
                      'domain': 'test.example',
                      'key_id': '256',
                      'protocol_type': '3',
                      'pubkey_base64': 'ABCDEFG'}]}
assert(True)
.
----------------------------------------------------------------------
Ran 4 tests in 0.011s

OK