tests.test_api¶
Location: Pulp Smash → API Documentation → tests.test_api
Unit tests for pulp_smash.api.
-
class
tests.test_api.ClientTestCase(methodName='runTest')¶ Bases:
unittest.case.TestCaseTests for
pulp_smash.api.Client.-
classmethod
setUpClass()¶ Assert methods delegate to
pulp_smash.api.Client.request().All methods on
pulp_smash.api.Client, such aspulp_smash.api.Client.delete(), should delegate topulp_smash.api.Client.request(). Mock outrequestand call the other methods.
-
test_called_once()¶ Assert each method calls
requestexactly once.
-
test_http_action()¶ Assert each method calls
requestwith the right HTTP action.
-
classmethod
-
class
tests.test_api.ClientTestCase2(methodName='runTest')¶ Bases:
unittest.case.TestCaseMore tests for
pulp_smash.api.Client.-
test_json_arg()¶ Assert methods with a
jsonargument pass on that argument.
-
test_response_handler()¶ Assert
__init__saves theresponse_handlerargument.The argument should be saved as an instance attribute.
-
-
class
tests.test_api.CodeHandlerTestCase(methodName='runTest')¶ Bases:
unittest.case.TestCaseTests 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
responseis returned.
-
-
class
tests.test_api.EchoHandlerTestCase(methodName='runTest')¶ Bases:
unittest.case.TestCaseTests 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
responseis returned.
-
-
class
tests.test_api.JsonHandlerTestCase(methodName='runTest')¶ Bases:
unittest.case.TestCaseTests 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
responseis returned.
-
-
class
tests.test_api.PageHandlerTestCase(methodName='runTest')¶ Bases:
unittest.case.TestCaseTests 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.TestCaseTests 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
responseis returned.
-
-
class
tests.test_api.SmartHandlerTestCase(methodName='runTest')¶ Bases:
unittest.case.TestCaseTests 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
responseis returned.
-
test_return_bare_response_when_pulp_2(*_)¶ Assert the passed-in
responseis returned if pulp is 2.
-
test_task_handler_is_called_for_tasks(*_)¶ Assert task handler is called when 202 with task is response.
-