def to_dict(self) -> Any:
     return Manifest.compact({
         "name": self.name,
         "repository": self.git_repo.url,
         "ref": self.git_repo.ref,
         "checks": self.checks
     })
Example #2
0
 def test_manifest_is_abstract(self) -> None:
     with self.assertRaises(TypeError) as context:
         Manifest(None)  # type: ignore[abstract]
     self.assertEqual(
         "Can't instantiate abstract class Manifest with abstract methods __init__",
         context.exception.__str__(),
     )
Example #3
0
 def append_component(self,
                      name: str,
                      repository_url: str,
                      ref: str,
                      commit_id: str,
                      location: str = None) -> None:
     component = Manifest.compact({
         "name": name,
         "repository": repository_url,
         "ref": ref,
         "commit_id": commit_id,
         "location": location,
     })
     self.data["components"].append(component)
 def test_compact(self) -> None:
     self.assertEqual(Manifest.compact({}), {})
     self.assertEqual(Manifest.compact({"x": "y"}), {"x": "y"})
     self.assertEqual(Manifest.compact({"x": "y", "z": []}), {"x": "y"})
     self.assertEqual(Manifest.compact({"x": "y", "z": None}), {"x": "y"})
     self.assertEqual(Manifest.compact({
         "x": "y",
         "z": {
             "t": None
         }
     }), {"x": "y"})
     self.assertEqual(Manifest.compact({"x": True}), {"x": True})
     self.assertEqual(Manifest.compact({"x": False}), {"x": False})
 def test_manifest_is_abstract(self) -> None:
     with self.assertRaises(TypeError) as context:
         Manifest(None)  # type: ignore[abstract]
     self.assertTrue(context.exception.__str__().startswith(
         "Can't instantiate abstract class Manifest with abstract method"))