tests.test_api

Location: Pulp SmashAPI Documentationtests.test_api

Unit tests for pulp_smash.api.

class tests.test_api.ClientTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Tests for pulp_smash.api.Client.

classmethod setUpClass()

Assert methods delegate to pulp_smash.api.Client.request().

All methods on pulp_smash.api.Client, such as pulp_smash.api.Client.delete(), should delegate to pulp_smash.api.Client.request(). Mock out request and call the other methods.

test_called_once()

Assert each method calls request exactly once.

test_http_action()

Assert each method calls request with the right HTTP action.

class tests.test_api.ClientTestCase2(methodName='runTest')

Bases: unittest.case.TestCase

More tests for pulp_smash.api.Client.

test_json_arg()

Assert methods with a json argument pass on that argument.

test_response_handler()

Assert __init__ saves the response_handler argument.

The argument should be saved as an instance attribute.

class tests.test_api.CodeHandlerTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Tests for pulp_smash.api.code_handler().

test_202_check_skipped()

Assert HTTP 202 responses are not treated specially.

test_raise_for_status()

Assert response.raise_for_status() is called.

test_return()

Assert the passed-in response is returned.

class tests.test_api.EchoHandlerTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Tests for pulp_smash.api.echo_handler().

test_202_check_skipped()

Assert HTTP 202 responses are not treated specially.

test_raise_for_status()

Assert response.raise_for_status() is not called.

test_return()

Assert the passed-in response is returned.

class tests.test_api.JsonHandlerTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Tests for pulp_smash.api.json_handler().

test_202_check_run()

Assert HTTP 202 responses are treated specially.

test_204_check_run()

Assert HTTP 204 responses are treated specially.

test_raise_for_status()

Assert response.raise_for_status() is called.

test_return()

Assert the JSON-decoded body of response is returned.

class tests.test_api.PageHandlerTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Tests for pulp_smash.api.page_handler().

test_204_check_run()

Assert HTTP 204 responses are immediately returned.

test_is_a_page()

Assert paginated responses are collected.

test_not_a_page()

Assert non-paginated responses are immediately returned.

test_pulp_2_error()

Assert this handler can’t be used with Pulp 2.

class tests.test_api.SafeHandlerTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Tests for pulp_smash.api.safe_handler().

test_202_check_run()

Assert HTTP 202 responses are treated specially.

test_raise_for_status()

Assert response.raise_for_status() is called.

test_return()

Assert the passed-in response is returned.

class tests.test_api.SmartHandlerTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Tests for pulp_smash.api.smart_handler().

client

Return a lazy client defaults to Pulp 3, creates on every call.

test_page_handler_is_called_for_json(*_)

Assert page handler is called when json without a task.

test_return_bare_response_when_not_json(*_)

Assert the passed-in response is returned.

test_return_bare_response_when_pulp_2(*_)

Assert the passed-in response is returned if pulp is 2.

test_task_handler_is_called_for_tasks(*_)

Assert task handler is called when 202 with task is response.