def test_parse_next_release_unsupported(self, mock_download): # We should jump over an unsupported release. LP: #1497024 meta = MetaReleaseCore() meta.current_dist_name = "foo" with tempfile.TemporaryFile() as f: f.write("""Dist: foo Supported: 1 Date: Thu, 26 Oct 2006 12:00:00 UTC Version: 1.0 Dist: goo Supported: 0 Date: Thu, 26 Oct 2016 12:00:00 UTC Version: 2.0 Dist: hoo Supported: 1 Date: Thu, 26 Oct 2026 12:00:00 UTC Version: 3.0 """.encode("utf-8")) f.seek(0) meta.metarelease_information = f meta.parse() self.assertEqual(meta.upgradable_to.name, "hoo") self.assertEqual(meta.upgradable_to.version, "3.0") self.assertEqual(meta.upgradable_to.supported, True)
def test_parse_good(self, mock_download): meta = MetaReleaseCore() meta.current_dist_name = "foo" with tempfile.TemporaryFile() as f: f.write("""Dist: foo Supported: 1 Date: Thu, 26 Oct 2006 12:00:00 UTC Version: 1.0 Dist: goo Supported: 1 Date: Thu, 26 Oct 2016 12:00:00 UTC Version: 2.0 """.encode("utf-8")) f.seek(0) meta.metarelease_information = f meta.parse() self.assertEqual(meta.upgradable_to.name, "goo") self.assertEqual(meta.upgradable_to.version, "2.0") self.assertEqual(meta.upgradable_to.supported, True)
def test_parse_next_release_unsupported_devel(self, mock_download): # We should not jump over an unsupported release if we are running in # "devel" mode. LP: #1497024 meta = MetaReleaseCore() meta.current_dist_name = "foo" meta.useDevelopmentRelease = True with tempfile.TemporaryFile() as f: f.write("""Dist: foo Supported: 1 Date: Thu, 26 Oct 2006 12:00:00 UTC Version: 1.0 Dist: goo Supported: 0 Date: Thu, 26 Oct 2016 12:00:00 UTC Version: 2.0 """.encode("utf-8")) f.seek(0) meta.metarelease_information = f meta.parse() self.assertEqual(meta.upgradable_to.name, "goo") self.assertEqual(meta.upgradable_to.version, "2.0") self.assertEqual(meta.upgradable_to.supported, False)