Location: Pulp SmashAPI Documentationpulp_smash.tests.pulp2.platform.api_v2.test_repository

Test the repository API endpoints.

The assumptions explored in this module have the following dependencies:

It is possible to create an untyped repository.
├── It is impossible to create a repository with a duplicate ID
│   or other invalid attributes.
├── It is possible to read a repository, including its importers and
│   distributors.
├── It is possible to update a repository.
└── It is possible to delete a repository.
class pulp_smash.tests.pulp2.platform.api_v2.test_repository.CreateFailureTestCase(*args, **kwargs)

Establish that repositories are not created in documented scenarios.

classmethod setUpClass()

Create several repositories.

Each repository is created to test a different failure scenario. The first repository is created in order to test duplicate ids.


Assert that each response body has the expected HTTP status code.


Assert the JSON body returned contains the correct keys.


Assert that the Location header is correctly set in the response.


Assert that each response has the expected HTTP status code.

class pulp_smash.tests.pulp2.platform.api_v2.test_repository.CreateSuccessTestCase(*args, **kwargs)

Establish we can create repositories.

classmethod setUpClass()

Create several repositories.

Create one repository with the minimum required attributes, and a second with all available attributes except importers and distributors.


Assert that each repository has the requested attributes.


Assert the Location header is correctly set in each response.

According to RFC 7231, the HTTP Location header may be either an absolute or relative URL. Thus, given this request:

GET /index.html HTTP/1.1
Host: www.example.com

These two responses are equivalent:

HTTP/1.1 302 FOUND
Location: http://www.example.com/index.php
HTTP/1.1 302 FOUND
Location: /index.php

This test abides by the RFC and allows Pulp to return either absolute or relative URLs.


Assert each response has an HTTP 201 status code.

class pulp_smash.tests.pulp2.platform.api_v2.test_repository.ReadUpdateDeleteTestCase(*args, **kwargs)

Establish we can read, update and delete repositories.

This test case assumes the assertions in CreateSuccessTestCase hold true.

classmethod setUpClass()

Create three repositories and read, update and delete them.


Assert the “read” response body contains the correct attributes.


Assert the read with details has the correct attributes.


Assert reading with importers/distributors returns correct attrs.


Assert each response has a correct HTTP status code.


Assert the “update” response body has the correct attributes.


Assert the “update” response body mentions no spawned tasks.