pulp_2_tests.tests.platform.api_v2.test_repository

Location: Pulp 2 TestsTestspulp_2_tests.tests.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_2_tests.tests.platform.api_v2.test_repository.CreateFailureTestCase(*args, **kwargs)

Bases: pulp_smash.pulp2.utils.BaseAPITestCase

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.

test_body_status_code()

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

test_exception_keys_json()

Assert the JSON body returned contains the correct keys.

test_location_header()

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

test_status_code()

Assert that each response has the expected HTTP status code.

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

Bases: pulp_smash.pulp2.utils.BaseAPITestCase

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.

test_attributes()

Assert that each repository has the requested attributes.

test_location_header()

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.

test_status_code()

Assert each response has an HTTP 201 status code.

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

Bases: pulp_smash.pulp2.utils.BaseAPITestCase

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.

test_read()

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

test_read_details()

Assert the read with details has the correct attributes.

test_read_imp_distrib()

Assert reading with importers/distributors returns correct attrs.

test_status_code()

Assert each response has a correct HTTP status code.

test_update_attributes_result()

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

test_update_spawned_tasks()

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