test bug #388187
authorZac Medico <zmedico@gentoo.org>
Sun, 23 Oct 2011 22:15:34 +0000 (15:15 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 23 Oct 2011 22:15:34 +0000 (15:15 -0700)
pym/portage/tests/emerge/test_global_updates.py [new file with mode: 0644]

diff --git a/pym/portage/tests/emerge/test_global_updates.py b/pym/portage/tests/emerge/test_global_updates.py
new file mode 100644 (file)
index 0000000..add4590
--- /dev/null
@@ -0,0 +1,37 @@
+# Copyright 2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+from portage.tests import TestCase
+from portage.update import parse_updates
+from portage.dep import Atom
+
+class ParseUpdatesTestCase(TestCase):
+
+       def testParseUpdates(self):
+               test_cases = (
+               (
+                       """
+slotmove invalid_atom 0 3
+slotmove !=invalid/blocker-3* 0 3
+slotmove =valid/atom-3* 0 3 invalid_extra_token
+slotmove =valid/atom-3* 0 3
+move valid/atom1 valid/atom2 invalid_extra_token
+move valid/atom1 invalid_atom2
+move invalid_atom1 valid/atom2
+move !invalid/blocker1 valid/atom2
+move valid/atom1 !invalid/blocker2
+move valid/atom1 valid/atom2
+""",
+                       [
+                               ['slotmove', Atom('=valid/atom-3*'), '0', '3'],
+                               ['move', 'valid/atom1', 'valid/atom2'],
+                       ],
+                       8,
+               ),
+
+               )
+
+               for input_content, expected_output, expected_error_count in test_cases:
+                       output_data, errors = parse_updates(input_content)
+                       self.assertEqual(output_data, expected_output)
+                       self.assertEqual(len(errors), expected_error_count)