Exemplo n.º 1
0
    def test_delete_random_docker_repo(self):
        """@Test: Create Docker-type repositories on multiple products and
        delete a random repository from a random product.

        @Assert: Random repository can be deleted from random product without
        altering the other products.

        @Feature: Docker

        """
        products = [
            make_product({'organization-id': self.org_id})
            for _
            in range(randint(2, 5))
        ]
        repos = []
        for product in products:
            for _ in range(randint(2, 3)):
                repos.append(_make_docker_repo(product['id']))
        # Select random repository and delete it
        repo = choice(repos)
        repos.remove(repo)
        Repository.delete({'id': repo['id']})
        with self.assertRaises(CLIReturnCodeError):
            Repository.info({'id': repo['id']})
        # Verify other repositories were not touched
        for repo in repos:
            result = Repository.info({'id': repo['id']})
            self.assertIn(
                result['product']['id'],
                [product['id'] for product in products],
            )
Exemplo n.º 2
0
    def test_positive_delete_by_id(self):
        """Check if repository can be created and deleted

        @Feature: Repository

        @Assert: Repository is created and then deleted
        """
        for name in valid_data_list():
            with self.subTest(name):
                new_repo = self._make_repository({u'name': name})
                Repository.delete({u'id': new_repo['id']})
                with self.assertRaises(CLIReturnCodeError):
                    Repository.info({u'id': new_repo['id']})
Exemplo n.º 3
0
    def test_positive_delete_ostree_by_id(self):
        """Delete Ostree repository by id

        @id: 171917f5-1a1b-440f-90c7-b8418f1da132

        @Assert: Repository is deleted by id
        """
        new_repo = self._make_repository(
            {u"content-type": u"ostree", u"publish-via-http": u"false", u"url": FEDORA23_OSTREE_REPO}
        )
        Repository.delete({u"id": new_repo["id"]})
        with self.assertRaises(CLIReturnCodeError):
            Repository.info({u"id": new_repo["id"]})
Exemplo n.º 4
0
    def test_positive_delete_by_id(self):
        """Check if repository can be created and deleted

        @id: bcf096db-0033-4138-90a3-cb7355d5dfaf

        @Assert: Repository is created and then deleted
        """
        for name in valid_data_list():
            with self.subTest(name):
                new_repo = self._make_repository({u"name": name})
                Repository.delete({u"id": new_repo["id"]})
                with self.assertRaises(CLIReturnCodeError):
                    Repository.info({u"id": new_repo["id"]})
Exemplo n.º 5
0
    def test_positive_delete_by_id(self):
        """Check if repository can be created and deleted

        @id: bcf096db-0033-4138-90a3-cb7355d5dfaf

        @Assert: Repository is created and then deleted
        """
        for name in valid_data_list():
            with self.subTest(name):
                new_repo = self._make_repository({u'name': name})
                Repository.delete({u'id': new_repo['id']})
                with self.assertRaises(CLIReturnCodeError):
                    Repository.info({u'id': new_repo['id']})
Exemplo n.º 6
0
    def test_delete_docker_repo(self):
        """@Test: Create and delete a Docker-type repository

        @Assert: A repository is created with a Docker image and then deleted.

        @Feature: Docker

        """
        repo = _make_docker_repo(
            make_product({'organization-id': self.org_id})['id'])
        Repository.delete({'id': repo['id']})
        with self.assertRaises(CLIReturnCodeError):
            Repository.info({'id': repo['id']})
Exemplo n.º 7
0
    def test_positive_delete_ostree_by_id(self):
        """Delete Ostree repository by id

        @id: 171917f5-1a1b-440f-90c7-b8418f1da132

        @Assert: Repository is deleted by id
        """
        new_repo = self._make_repository({
            u'content-type': u'ostree',
            u'publish-via-http': u'false',
            u'url': FEDORA23_OSTREE_REPO,
        })
        Repository.delete({u'id': new_repo['id']})
        with self.assertRaises(CLIReturnCodeError):
            Repository.info({u'id': new_repo['id']})
Exemplo n.º 8
0
    def test_positive_delete_1(self, name):
        """@Test: Check if repository can be created and deleted

        @Feature: Repository

        @Assert: Repository is created and then deleted

        """

        new_repo = self._make_repository({u'name': name})
        # Assert that name matches data passed
        self.assertEqual(new_repo['name'], name, "Names don't match")

        # Delete it
        result = Repository.delete({u'id': new_repo['id']})
        self.assertEqual(result.return_code, 0, "Repository was not deleted")
        self.assertEqual(len(result.stderr), 0, "No error was expected")

        # Fetch it
        result = Repository.info({
            u'id': new_repo['id'],
        })
        self.assertNotEqual(result.return_code, 0,
                            "Repository should not be found")
        self.assertGreater(len(result.stderr), 0, "Expected an error here")
Exemplo n.º 9
0
    def test_positive_delete_ostree_by_name(self):
        """Delete Ostree repository by name

        @id: 0b545c22-acff-47b6-92ff-669b348f9fa6

        @Assert: Repository is deleted by name
        """
        new_repo = self._make_repository(
            {u"content-type": u"ostree", u"publish-via-http": u"false", u"url": FEDORA23_OSTREE_REPO}
        )
        Repository.delete(
            {
                u"name": new_repo["name"],
                u"product": new_repo["product"]["name"],
                u"organization": new_repo["organization"],
            }
        )
        with self.assertRaises(CLIReturnCodeError):
            Repository.info({u"name": new_repo["name"]})
Exemplo n.º 10
0
    def test_positive_delete_ostree_by_name(self):
        """Delete Ostree repository by name

        @id: 0b545c22-acff-47b6-92ff-669b348f9fa6

        @Assert: Repository is deleted by name
        """
        new_repo = self._make_repository({
            u'content-type': u'ostree',
            u'publish-via-http': u'false',
            u'url': FEDORA23_OSTREE_REPO,
        })
        Repository.delete({
            u'name': new_repo['name'],
            u'product': new_repo['product']['name'],
            u'organization': new_repo['organization']
        })
        with self.assertRaises(CLIReturnCodeError):
            Repository.info({u'name': new_repo['name']})
Exemplo n.º 11
0
    def test_delete_docker_repo(self):
        """@Test: Create and delete a Docker-type repository

        @Assert: A repository is created with a Docker image and then deleted.

        @Feature: Docker

        """
        repo = _make_docker_repo(
            make_product({'organization-id': self.org_id})['id'])
        result = Repository.delete({'id': repo['id']})
        self.assertEqual(result.return_code, 0)
        result = Repository.info({'id': repo['id']})
        self.assertNotEqual(result.return_code, 0)
Exemplo n.º 12
0
    def test_positive_delete_1(self, test_data):
        """@Test: Check if repository can be created and deleted

        @Feature: Repository

        @Assert: Repository is created and then deleted

        """

        new_repo = self._make_repository({u'name': test_data['name']})
        # Assert that name matches data passed
        self.assertEqual(
            new_repo['name'],
            test_data['name'],
            "Names don't match"
        )

        # Delete it
        result = Repository.delete(
            {u'id': new_repo['id']})
        self.assertEqual(
            result.return_code,
            0,
            "Repository was not deleted")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")

        # Fetch it
        result = Repository.info(
            {
                u'id': new_repo['id'],
            }
        )
        self.assertNotEqual(
            result.return_code,
            0,
            "Repository should not be found"
        )
        self.assertGreater(
            len(result.stderr),
            0,
            "Expected an error here"
        )
Exemplo n.º 13
0
    def test_positive_delete_1(self, name):
        """@Test: Check if repository can be created and deleted

        @Feature: Repository

        @Assert: Repository is created and then deleted

        """

        new_repo = self._make_repository({u'name': name})
        # Assert that name matches data passed
        self.assertEqual(new_repo['name'], name)

        # Delete it
        result = Repository.delete({u'id': new_repo['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        # Fetch it
        result = Repository.info({
            u'id': new_repo['id'],
        })
        self.assertNotEqual(result.return_code, 0)
        self.assertGreater(len(result.stderr), 0)