3 from base_test import DakTestCase
7 from daklib.utils import process_gpgv_output
9 class ProcessGPGVOutputTestCase(DakTestCase):
10 def assertParse(self, input, output):
11 self.assertEqual(process_gpgv_output(input)[0], output)
13 def assertNotParse(self, input):
14 ret = process_gpgv_output(input)
15 self.assertNotEqual(len(ret[1]), 0)
20 self.assertParse('', {})
23 self.assertNotParse('foo')
24 self.assertNotParse(' foo ')
25 self.assertNotParse('[PREFIXPG:] KEY VAL1 VAL2 VAL3')
29 '[GNUPG:] KEY VAL1 VAL2 VAL3',
30 {'KEY': ['VAL1', 'VAL2', 'VAL3']},
34 self.assertParse('[GNUPG:] KEY', {'KEY': []})
36 def testDuplicate(self):
37 self.assertNotParse('[GNUPG:] TEST_KEY\n[GNUPG:] TEST_KEY')
38 self.assertNotParse('[GNUPG:] KEY VAL1\n[GNUPG:] KEY VAL2')
40 def testDuplicateSpecial(self):
41 # NODATA and friends are special
42 for special in ('NODATA', 'SIGEXPIRED', 'KEYEXPIRED'):
44 '[GNUPG:] %s\n[GNUPG:] %s' % (special, special),
48 if __name__ == '__main__':