inspirehep.testlib.api package¶
Submodules¶
inspirehep.testlib.api.author_form module¶
Literature suggestion form testlib.
Bases:
object
Bases:
object
inspirehep.testlib.api.base_resource module¶
Base resource class and utils.
inspirehep.testlib.api.callback module¶
/callback endpoint api client and resources.
-
class
inspirehep.testlib.api.callback.
CallbackClient
(client)[source]¶ Bases:
object
Client for the Inspire callback
-
CALLBACK_URL
= '/callback/workflows'¶
-
robotupload
(nonce, results)[source]¶ Parameters: - nonce (int) – nonce parameter passed to robotupload, usually the workflow id.
- results (list[RobotuploadCallbackResult]) – list of robotupload results.
-
inspirehep.testlib.api.e2e module¶
/holdingpen endopint api client and resources.
inspirehep.testlib.api.holdingpen module¶
/holdingpen endopint api client and resources.
-
class
inspirehep.testlib.api.holdingpen.
HoldingpenApiClient
(client)[source]¶ Bases:
object
Client for the Inspire Holdingpen
-
HOLDINGPEN_API_URL
= '/api/holdingpen/'¶
-
HOLDINGPEN_EDIT_URL
= '/api/holdingpen/{workflow_id}/action/edit'¶
-
HOLDINGPEN_RESOLVE_URL
= '/api/holdingpen/{workflow_id}/action/resolve'¶
-
HOLDINGPEN_RESTART_URL
= '/api/holdingpen/{workflow_id}/action/restart'¶
-
edit_workflow
(holdingpen_entry)[source]¶ Helper method to edit a holdingpen entry.
Parameters: holdingpen_entry (HoldingpenResource) – entry updated with the already changed data. Returns: - The actual http response to the last call (the
- actual /edit endpoint).
Return type: requests.Response Raises: requests.exceptions.BaseHttpError
– any error related to the http calls made.Example
>>> my_entry = holdingpen_client.get_detail_entry(holdingpen_id=1234) >>> my_entry.core = False # do some changes >>> holdingpen_client.edit_workflow(holdingpen_entry=my_entry) <Response [200]>
-
-
class
inspirehep.testlib.api.holdingpen.
HoldingpenAuthorResource
(display_name, **kwargs)[source]¶ Bases:
inspirehep.testlib.api.holdingpen.HoldingpenResource
Holdingpen for an author workflow.
-
class
inspirehep.testlib.api.holdingpen.
HoldingpenLiteratureResource
(titles, auto_approved=None, doi=None, arxiv_eprint=None, approved_match=None, **kwargs)[source]¶ Bases:
inspirehep.testlib.api.holdingpen.HoldingpenResource
Holdingpen entry for a literature workflow.
-
class
inspirehep.testlib.api.holdingpen.
HoldingpenResource
(workflow_id, approved, is_update, core, status, control_number)[source]¶ Bases:
inspirehep.testlib.api.base_resource.BaseResource
Inspire holdingpen entry to represent a workflow
-
classmethod
from_json
(json, workflow_id=None)[source]¶ Constructor for a holdingpen entry, it will be able to be mapped to and from json, and used to fully edit entries. Usually you pass to it the full raw json from the details of a holdingpen entry.
Parameters: json (dict) – dictionary of a single entry as returned by the api.
-
classmethod
inspirehep.testlib.api.literature module¶
/literature endpoint api client and resources.
-
class
inspirehep.testlib.api.literature.
LiteratureApiClient
(client)[source]¶ Bases:
object
Client for the Inspire Literature section
-
LITERATURE_API_URL
= '/api/literature/'¶
-
-
class
inspirehep.testlib.api.literature.
LiteratureResource
(control_number, doi, arxiv_eprint, titles)[source]¶ Bases:
inspirehep.testlib.api.base_resource.BaseResource
Inspire base entry to represent a literature record
inspirehep.testlib.api.literature_form module¶
Literature suggestion form testlib.
inspirehep.testlib.api.mitm_client module¶
Client interface for INSPIRE-MITMPROXY.
-
class
inspirehep.testlib.api.mitm_client.
MITMClient
(proxy_host='http://mitm-manager.local')[source]¶ Bases:
object
-
inspirehep.testlib.api.mitm_client.
with_mitmproxy
(*args, **kwargs)[source]¶ Decorator to abstract fixture recording and scenario setup for the E2E tests with mitmproxy.
Parameters: - scenario_name (Optional[str]) – scenario name, by default test name without ‘test_‘ prefix
- should_record (Optional[bool]) – is recording new interactions allowed during test run, by default False
- *args (List[Callable]) – list of length of either zero or one: decorated function. This is to allow the decorator to function both with and without calling it with parameters: if args is present, we can deduce that the decorator was used without parameters.
Returns: - a decorator the can be used both with and without calling brackets
(if all params should be default)
Return type: Callable
Module contents¶
Main API client for Inspire
-
class
inspirehep.testlib.api.
InspireApiClient
(auto_login=True, base_url='http://inpirehep.local')[source]¶ Bases:
object
Inspire Client for end-to-end testing
-
LOCAL_LOGIN_URL
= '/login/?next=%2F&local=1'¶
-