Example #1
0
    def test_list(self):
        self.collection_api.list.return_value = galaxy_pulp.ResultsPage(
            count=1, results=[])
        response = self.client.get(f"/{API_PREFIX}/v3/collections/")

        assert response.status_code == 200
        self.collection_api.list.assert_called_once_with(prefix=API_PREFIX,
                                                         offset=0,
                                                         limit=10)
Example #2
0
    def test_list_limit_offset(self):
        self.tags_api.list.return_value = galaxy_pulp.ResultsPage(count=0,
                                                                  results=[])
        response = self.client.get(f"/{API_PREFIX}/v3/_ui/tags/",
                                   data={
                                       "limit": 10,
                                       "offset": 20
                                   })

        assert response.status_code == 200
        self.tags_api.list.assert_called_once_with(limit=10, offset=20)
    def test_list(self):
        self.versions_api.list.return_value = galaxy_pulp.ResultsPage(
            count=1, results=[]
        )
        response = self.client.get(
            f"/{API_PREFIX}/v3/collections/ansible/nginx/versions/"
        )

        assert response.status_code == 200
        self.versions_api.list.assert_called_once_with(
            prefix=API_PREFIX, namespace="ansible", name="nginx", limit=10, offset=0
        )
Example #4
0
    def test_list(self):
        self.tags_api.list.return_value = galaxy_pulp.ResultsPage(count=2,
                                                                  results=[{
                                                                      "name":
                                                                      "foo"
                                                                  }, {
                                                                      "name":
                                                                      "bar"
                                                                  }])
        response = self.client.get(f"/{API_PREFIX}/v3/_ui/tags/")

        self.tags_api.list.assert_called_once_with(offset=0, limit=10)
        assert response.status_code == 200
        assert response.data['meta']['count'] == 2
        assert response.data['data'] == [{"name": "foo"}, {"name": "bar"}]
Example #5
0
    def test_list_limit_offset_empty(self):
        self.versions_api.list.return_value = galaxy_pulp.ResultsPage(
            count=1, results=[])
        response = self.client.get(
            f"/{API_PREFIX}/v3/collections/ansible/nginx/versions/",
            data={
                "limit": 10,
                "offset": 20
            },
        )

        assert response.status_code == 404
        self.versions_api.list.assert_called_once_with(
            prefix=API_PREFIX,
            namespace="ansible",
            name="nginx",
            limit=10,
            offset=20,
            certification=constants.CertificationStatus.CERTIFIED.value)