Ejemplo n.º 1
0
    def test_03_fully_update(self):
        """Attempt to update a content unit using HTTP PUT.

        This HTTP method is not supported and a HTTP exception is expected.
        """
        attrs = gen_container_content_attrs(self.artifact)
        with self.assertRaises(AttributeError) as exc:
            self.container_content_api.update(self.content_unit["pulp_href"], attrs)
        msg = "object has no attribute 'update'"
        self.assertIn(msg, exc.exception.args[0])
Ejemplo n.º 2
0
 def test_01_create_content_unit(self):
     """Create content unit."""
     attrs = gen_container_content_attrs(self.artifact)
     # FIXME: Currently, it is not possible to create or update a content unit via an
     #  ordinary content type's endpoint. One must use a repository's endpoint for this.
     response = self.container_content_api.create(**attrs)
     created_resources = monitor_task(response.task).created_resources
     content_unit = self.container_content_api.read(created_resources[0])
     self.content_unit.update(content_unit.to_dict())
     for key, val in attrs.items():
         with self.subTest(key=key):
             self.assertEqual(self.content_unit[key], val)