|
21 | 21 | make_parser, |
22 | 22 | ) |
23 | 23 | from rift.Package import Package |
24 | | -from rift.RPM import RPM |
| 24 | +from rift.RPM import RPM, Spec |
25 | 25 | from rift.run import RunResult |
26 | 26 | from rift import RiftError |
27 | 27 |
|
@@ -697,6 +697,63 @@ def test_action_sync_missing_output_parent(self): |
697 | 697 | main(['sync']) |
698 | 698 |
|
699 | 699 |
|
| 700 | +class ControllerProjectActionChangelogTest(RiftProjectTestCase): |
| 701 | + """ |
| 702 | + Tests class for Controller action changelog |
| 703 | + """ |
| 704 | + |
| 705 | + def test_action_changelog_without_pkg(self): |
| 706 | + """changelog without package fails """ |
| 707 | + with self.assertRaisesRegex(SystemExit, "2"): |
| 708 | + main(['changelog']) |
| 709 | + |
| 710 | + def test_action_changelog_without_comment(self): |
| 711 | + """changelog without comment fails """ |
| 712 | + with self.assertRaisesRegex(SystemExit, "2"): |
| 713 | + main(['changelog', 'pkg']) |
| 714 | + |
| 715 | + def test_action_changelog_without_maintainer(self): |
| 716 | + """changelog without maintainer """ |
| 717 | + with self.assertRaisesRegex(RiftError, "You must specify a maintainer"): |
| 718 | + main(['changelog', 'pkg', '-c', 'basic change']) |
| 719 | + |
| 720 | + def test_action_changelog_pkg_not_found(self): |
| 721 | + """changelog package not found""" |
| 722 | + with self.assertRaisesRegex( |
| 723 | + RiftError, |
| 724 | + "Package 'pkg' directory does not exist"): |
| 725 | + main(['changelog', 'pkg', '-c', 'basic change', '-t', 'Myself']) |
| 726 | + |
| 727 | + def test_action_changelog(self): |
| 728 | + """simple changelog""" |
| 729 | + self.make_pkg() |
| 730 | + self.assertEqual( |
| 731 | + main(['changelog', 'pkg', '-c', 'basic change', '-t', 'Myself']), 0) |
| 732 | + spec = Spec(filepath=self.pkgspecs['pkg']) |
| 733 | + spec.load() |
| 734 | + self.assertEqual(spec.changelog_name, 'Myself <buddy@somewhere.org> - 1.0-1') |
| 735 | + self.assertEqual(spec.version, '1.0') |
| 736 | + self.assertEqual(spec.release, '1') |
| 737 | + |
| 738 | + def test_action_changelog_bump(self): |
| 739 | + """simple changelog with bump""" |
| 740 | + self.make_pkg() |
| 741 | + self.assertEqual( |
| 742 | + main(['changelog', 'pkg', '-c', 'basic change', '-t', 'Myself', '--bump']), |
| 743 | + 0) |
| 744 | + spec = Spec(filepath=self.pkgspecs['pkg']) |
| 745 | + spec.load() |
| 746 | + self.assertEqual(spec.changelog_name, 'Myself <buddy@somewhere.org> - 1.0-2') |
| 747 | + self.assertEqual(spec.version, '1.0') |
| 748 | + self.assertEqual(spec.release, '2') |
| 749 | + |
| 750 | + def test_action_changelog_unknown_maintainer(self): |
| 751 | + """changelog with unknown maintainer""" |
| 752 | + self.make_pkg() |
| 753 | + with self.assertRaises(TypeError): |
| 754 | + main(['changelog', 'pkg', '-c', 'basic change', '-t', 'Fail']) |
| 755 | + |
| 756 | + |
700 | 757 | class ControllerArgumentsTest(RiftTestCase): |
701 | 758 | """ Arguments parsing tests for Controller module""" |
702 | 759 |
|
|
0 commit comments