LEFT | RIGHT |
1 # This file is part of the Juju GUI, which lets users view and manage Juju | 1 # This file is part of the Juju GUI, which lets users view and manage Juju |
2 # environments within a graphical interface (https://launchpad.net/juju-gui). | 2 # environments within a graphical interface (https://launchpad.net/juju-gui). |
3 # Copyright (C) 2012-2013 Canonical Ltd. | 3 # Copyright (C) 2012-2013 Canonical Ltd. |
4 # | 4 # |
5 # This program is free software: you can redistribute it and/or modify it under | 5 # This program is free software: you can redistribute it and/or modify it under |
6 # the terms of the GNU Affero General Public License version 3, as published by | 6 # the terms of the GNU Affero General Public License version 3, as published by |
7 # the Free Software Foundation. | 7 # the Free Software Foundation. |
8 # | 8 # |
9 # This program is distributed in the hope that it will be useful, but WITHOUT | 9 # This program is distributed in the hope that it will be useful, but WITHOUT |
10 # ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, | 10 # ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 def test_latest_local_release(self): | 644 def test_latest_local_release(self): |
645 # Ensure the latest local release is correctly parsed. | 645 # Ensure the latest local release is correctly parsed. |
646 expected = ('local', None) | 646 expected = ('local', None) |
647 self.assertTupleEqual(expected, parse_source('local')) | 647 self.assertTupleEqual(expected, parse_source('local')) |
648 | 648 |
649 def test_latest_stable_release(self): | 649 def test_latest_stable_release(self): |
650 # Ensure the latest stable release is correctly parsed. | 650 # Ensure the latest stable release is correctly parsed. |
651 expected = ('stable', None) | 651 expected = ('stable', None) |
652 self.assertTupleEqual(expected, parse_source('stable')) | 652 self.assertTupleEqual(expected, parse_source('stable')) |
653 | 653 |
| 654 def test_latest_develop_release(self): |
| 655 # Ensure the latest develop branch release is correctly parsed. |
| 656 expected = ('develop', None) |
| 657 self.assertTupleEqual(expected, parse_source('develop')) |
| 658 |
654 @mock.patch('utils.log') | 659 @mock.patch('utils.log') |
655 def test_stable_release(self, mock_log): | 660 def test_stable_release(self, mock_log): |
656 # Ensure a specific stable release is correctly parsed. | 661 # Ensure a specific stable release is correctly parsed. |
657 expected = ('stable', '0.1.0') | 662 expected = ('stable', '0.1.0') |
658 self.assertTupleEqual(expected, parse_source('0.1.0')) | 663 self.assertTupleEqual(expected, parse_source('0.1.0')) |
659 | 664 |
660 def test_git_branch(self): | 665 def test_git_branch(self): |
661 # Ensure a Git branch is correctly parsed. | 666 # Ensure a Git branch is correctly parsed. |
662 sources = ( | 667 source = 'https://github.com/juju/juju-gui.git' |
663 'https://github.com/juju/juju-gui.git', | 668 expected = ('branch', (source, None)) |
664 'https://github.com/juju/juju-gui.git' | 669 self.assertEqual(expected, parse_source(source)) |
665 ) | |
666 for source in sources: | |
667 expected = ('branch', (source, None)) | |
668 self.assertEqual(expected, parse_source(source)) | |
669 | 670 |
670 def test_git_branch_and_revision(self): | 671 def test_git_branch_and_revision(self): |
671 # A Bazaar branch is correctly parsed when including revision. | 672 # A Bazaar branch is correctly parsed when including revision. |
672 sources = ( | 673 sources = ( |
673 'https://github.com/juju/juju-gui.git test_feature', | 674 'https://github.com/juju/juju-gui.git test_feature', |
674 'https://github.com/juju/juju-gui.git @de5e6', | 675 'https://github.com/juju/juju-gui.git @de5e6', |
675 ) | 676 ) |
676 | 677 |
677 for source in sources: | 678 for source in sources: |
678 expected = ('branch', tuple(source.rsplit(' ', 1))) | 679 expected = ('branch', tuple(source.rsplit(' ', 1))) |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 | 1117 |
1117 class FauxLaunchpad(object): | 1118 class FauxLaunchpad(object): |
1118 projects = {'juju-gui': FauxProject()} | 1119 projects = {'juju-gui': FauxProject()} |
1119 | 1120 |
1120 url = get_npm_cache_archive_url(Launchpad=FauxLaunchpadFactory()) | 1121 url = get_npm_cache_archive_url(Launchpad=FauxLaunchpadFactory()) |
1121 self.assertEqual(url, 'http://launchpad.example/path/to/cache/file') | 1122 self.assertEqual(url, 'http://launchpad.example/path/to/cache/file') |
1122 | 1123 |
1123 | 1124 |
1124 if __name__ == '__main__': | 1125 if __name__ == '__main__': |
1125 unittest.main(verbosity=2) | 1126 unittest.main(verbosity=2) |
LEFT | RIGHT |