def test_origin(self):
        ch = Channel.parse("latest/stable")
        p = Platform.parse("amd64/ubuntu/focal")

        o = Origin(Source.CHARM_HUB, ch, p)
        self.assertEqual(
            str(o),
            "origin using source charm-hub for channel latest/stable and platform amd64/ubuntu/focal"
        )
 def test_str_then_normalize(self):
     ch = Channel.parse("latest/stable").normalize()
     self.assertEqual(str(ch), "stable")
 def test_str(self):
     ch = Channel.parse("latest/stable")
     self.assertEqual(str(ch), "latest/stable")
 def test_str_numeric(self):
     ch = Channel.parse("2.0.7/stable")
     self.assertEqual(str(ch), "2.0.7/stable")
 def test_str_risk_only(self):
     ch = Channel.parse("stable")
     self.assertEqual(str(ch), "stable")
 def test_str_track_only(self):
     ch = Channel.parse("2.0.1")
     self.assertEqual(str(ch), "2.0.1/stable")
 def test_parse_then_normalize(self):
     ch = Channel.parse("latest/stable").normalize()
     self.assertEqual(ch, Channel(None, "stable"))
 def test_parse_numeric(self):
     ch = Channel.parse("2.0.7/stable")
     self.assertEqual(ch, Channel("2.0.7", "stable"))
 def test_parse(self):
     ch = Channel.parse("latest/stable")
     self.assertEqual(ch, Channel("latest", "stable"))
 def test_parse_track_only(self):
     ch = Channel.parse("2.0.1")
     self.assertEqual(ch, Channel("2.0.1", "stable"))
 def test_parse_risk_only(self):
     ch = Channel.parse("stable")
     self.assertEqual(ch, Channel(None, "stable"))