예제 #1
0
    def test_upgrade_unexpected_version(self):
        # Neither current modulemd version cannot be unexpected
        with self.assertRaises(ValueError) as context:
            upgrade("version: 5", 2)
        self.assertIn("Unexpected modulemd version", str(context.exception))

        # Nor the wanted one
        with self.assertRaises(ValueError) as context:
            upgrade("version: 1", 5)
        self.assertIn("Unexpected modulemd version", str(context.exception))
예제 #2
0
 def test_upgrade(self):
     result = upgrade(yaml4_v1, 2)
     mod_stream = _yaml2stream(result)
     self.assertEqual(mod_stream.get_mdversion(), 2)
     self.assertEqual(mod_stream.get_module_name(), "")
     self.assertEqual(mod_stream.get_summary(),
                      "A test module in all its beautiful beauty")
예제 #3
0
 def test_upgrade_empty_yaml(self, mod_yaml):
     with self.assertRaises(ValueError) as context:
         upgrade(mod_yaml, 2)
     self.assertIn("Missing modulemd version", str(context.exception))
예제 #4
0
 def test_upgrade_cannot_downgrade(self):
     with self.assertRaises(ValueError) as context:
         upgrade(yaml1, 1)
     self.assertIn("Cannot downgrade modulemd version",
                   str(context.exception))
예제 #5
0
 def test_upgrade_to_same_version(self):
     result = upgrade(yaml1, 2)
     self.assertEqual(result, yaml1)
예제 #6
0
 def test_upgrade_empty_yaml(self):
     for mod_yaml in [None, "", "foo: bar"]:
         with self.assertRaises(ValueError) as context:
             upgrade(mod_yaml, 2)
         self.assertIn("Missing modulemd version", str(context.exception))