diff --git a/juju/origin.py b/juju/origin.py index 083e16221..0dca74686 100644 --- a/juju/origin.py +++ b/juju/origin.py @@ -97,7 +97,9 @@ def parse(s): return Channel(track, risk) def normalize(self): - track = self.track if self.track != "latest" else "" + # TODO (cderici): this is essentially a noop, needs to be revised in both + # 2.9 and 3.x + track = self.track if self.track != "" else "" risk = self.risk if self.risk != "" else "" return Channel(track, risk) diff --git a/tests/unit/test_bundle.py b/tests/unit/test_bundle.py index 64c569ba6..d2f9370ab 100644 --- a/tests/unit/test_bundle.py +++ b/tests/unit/test_bundle.py @@ -355,7 +355,7 @@ async def test_run_with_charmhub_charm_no_channel(self, event_loop): context = Mock() context.resolve.return_value = "ch:charm1" - context.origins = {"ch:charm1": {"stable": Mock()}} + context.origins = {"ch:charm1": {"latest/stable": Mock()}} context.trusted = False context.model = model diff --git a/tests/unit/test_origin.py b/tests/unit/test_origin.py index b2b3fa5eb..979cdc658 100644 --- a/tests/unit/test_origin.py +++ b/tests/unit/test_origin.py @@ -30,7 +30,7 @@ def test_parse_numeric(self): def test_parse_then_normalize(self): ch = Channel.parse("latest/stable").normalize() - self.assertEqual(ch, Channel(None, "stable")) + self.assertEqual(ch, Channel("latest", "stable")) def test_str_risk_only(self): ch = Channel.parse("stable") @@ -50,7 +50,7 @@ def test_str_numeric(self): def test_str_then_normalize(self): ch = Channel.parse("latest/stable").normalize() - self.assertEqual(str(ch), "stable") + self.assertEqual(str(ch), "latest/stable") class TestPlatform(unittest.TestCase):