def test_06_publication_create_order(self):
        """Assert that publications are ordered by created time.

        This test targets the following issues:

        * `Pulp Smash #954 <https://github.com/PulpQE/pulp-smash/issues/954>`_
        * `Pulp #3576 <https://pulp.plan.io/issues/3576>`_
        """
        # Create more 2 publications for the same repo
        for _ in range(2):
            publish(self.cfg, self.publisher, self.repo)

        # Read publications
        publications = self.client.get(
            PUBLICATIONS_PATH,
            params={'publisher': self.publisher['_href']}
        )
        self.assertEqual(len(publications), 3)

        # Assert publications are ordered by _created field in descending order
        for i, publication in enumerate(publications[:-1]):
            self.assertGreater(
                parse_date_from_string(publication['_created']),  # Current
                parse_date_from_string(publications[i + 1]['_created'])  # Prev
            )
Example #2
0
    def test_06_publication_create_order(self):
        """Assert that publications are ordered by created time.

        This test targets the following issues:

        * `Pulp Smash #954 <https://github.com/PulpQE/pulp-smash/issues/954>`_
        * `Pulp #3576 <https://pulp.plan.io/issues/3576>`_
        """
        # Create more 2 publications for the same repo
        for _ in range(2):
            publish(self.cfg, self.publisher, self.repo)

        # Read publications
        publications = self.client.get(
            PUBLICATIONS_PATH,
            params={'publisher': self.publisher['_href']}
        )
        self.assertEqual(len(publications), 3)

        # Assert publications are ordered by _created field in descending order
        for i, publication in enumerate(publications[:-1]):
            self.assertGreater(
                parse_date_from_string(publication['_created']),  # Current
                parse_date_from_string(publications[i + 1]['_created'])  # Prev
            )
Example #3
0
    def test_06_publication_create_order(self):
        """Assert that publications are ordered by created time.

        This test targets the following issues:

        * `Pulp Smash #954 <https://github.com/pulp/pulp-smash/issues/954>`_
        * `Pulp #3576 <https://pulp.plan.io/issues/3576>`_
        """
        # Create more 2 publications for the same repo
        for _ in range(2):
            create_file_publication(self.cfg, self.repo)

        # Read publications
        publications = self.client.get(FILE_PUBLICATION_PATH)
        self.assertEqual(len(publications), 3)

        # Assert publications are ordered by pulp_created field in descending order
        for i, publication in enumerate(publications[:-1]):
            self.assertGreater(
                parse_date_from_string(publication["pulp_created"]),  # Current
                parse_date_from_string(publications[i + 1]["pulp_created"]),  # Prev
            )