def test_05_duplicate_raise_error(self):
     """Attempt to create duplicate package."""
     attrs = gen_rpm_content_attrs(self.artifact, RPM_PACKAGE_FILENAME)
     response = self.rpm_content_api.create(**attrs)
     task_result = monitor_task(response.task)
     msg = "There is already a package with"
     self.assertTrue(msg in task_result['error']['description'])
Exemple #2
0
 def test_05_duplicate_raise_error(self):
     """Attempt to create duplicate package."""
     attrs = gen_rpm_content_attrs(self.artifact, RPM_PACKAGE_FILENAME)
     response = self.rpm_content_api.create(**attrs)
     with self.assertRaises(PulpTaskError) as cm:
         monitor_task(response.task)
     task_result = cm.exception.task.to_dict()
     msg = "There is already a package with"
     self.assertTrue(msg in task_result["error"]["description"])
Exemple #3
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_rpm_content_attrs(self.artifact, RPM_PACKAGE_FILENAME2)
        with self.assertRaises(AttributeError) as exc:
            self.rpm_content_api.update(self.content_unit["pulp_href"], attrs)
        msg = "object has no attribute 'update'"
        self.assertIn(msg, exc.exception.args[0])
Exemple #4
0
 def test_01_create_content_unit(self):
     """Create content unit."""
     attrs = gen_rpm_content_attrs(self.artifact, RPM_PACKAGE_FILENAME)
     response = self.rpm_content_api.create(**attrs)
     # rpm package doesn't keep relative_path but the location href
     del attrs["relative_path"]
     created_resources = monitor_task(response.task).created_resources
     content_unit = self.rpm_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)