def test_use_ticket_key_as_ticket_detail(self): self.maxDiff = None self.assertEqual( [ ConfigItem("site", "1.1.1.1"), ConfigItem('expire', '300'), ConfigItem('site', '2.2.2.2'), ConfigItem('arbitrator', '3.3.3.3'), ConfigItem("ticket", "TA", [ ConfigItem("timeout", "10"), ConfigItem('--nonexistent', 'value'), ConfigItem("expire", "300"), ]), ConfigItem("ticket", "TB", [ ConfigItem("timeout", "20"), ConfigItem("renewal-freq", "40"), ]), ], config_parser.organize_lines([ ("site", "1.1.1.1"), ("expire", "300"), # out of ticket content is kept global ("ticket", "TA"), ("site", "2.2.2.2"), # move to global ("timeout", "10"), ("--nonexistent", "value"), # no global is kept under ticket ("expire", "300"), ("ticket", "TB"), ('arbitrator', '3.3.3.3'), ("timeout", "20"), ("renewal-freq", "40"), ]) )
def test_move_non_ticket_config_keys_above_tickets(self): self.assertEqual([ ConfigItem("site", "1.1.1.1"), ConfigItem('site', '2.2.2.2'), ConfigItem('arbitrator', '3.3.3.3'), ConfigItem("ticket", "TA"), ], config_parser.organize_lines([ ("site", "1.1.1.1"), ("ticket", "TA"), ('site', '2.2.2.2'), ('arbitrator', '3.3.3.3'), ]))
def test_move_non_ticket_config_keys_above_tickets(self): self.assertEqual( [ ConfigItem("site", "1.1.1.1"), ConfigItem('site', '2.2.2.2'), ConfigItem('arbitrator', '3.3.3.3'), ConfigItem("ticket", "TA"), ], config_parser.organize_lines([ ("site", "1.1.1.1"), ("ticket", "TA"), ('site', '2.2.2.2'), ('arbitrator', '3.3.3.3'), ]) )