Example Client¶
-
class
swagccg.tests.
TestPetStoreClient
(deployment)¶ Summary of this class goes here Detailed explanation goes here
-
API_BASE_URL
= "''"¶ None
-
API_ENDPOINTS
= "''"¶ dummy
-
API_LOGIN_URL
= "''"¶ None
-
API_PORT
= "''"¶ None
-
API_PROTOCOL
= "''"¶ None
-
API_REFRESH_URL
= "''"¶ None
-
API_TOKEN
= "''"¶ None
-
API_URL
= "''"¶ None
-
API_URL_BASE
= "''"¶ None
-
AUTH_HEADER_NAME
= "'Authorization'"¶ None
-
AUTH_PREFIX
= "'Bearer '"¶ mind the whitespace
-
AUTH_TOKEN_KEY
= "'access_token'"¶ None
-
AUTH_TOKEN_KEY_REFRESH
= "'refreshed_token'"¶ None
-
BASE_PATH
= "''"¶ None
-
DEPLOYMENT
= "''"¶ None
-
LOGIN_TIMESTAMP
= "''"¶ None
-
METHODS_WITH_BODY
= "{'POST', 'PUT', 'PATCH'}"¶ None
-
REFRESH_KEY
= "'token'"¶ None
-
REFRESH_TIMESTAMP
= "''"¶ None
-
static
TestPetStoreClient
(deployment)¶ ClassConstructor equivalent of __init__
Todo
almost everything here should be configured during client creation
-
create_users_with_array_input_r
(self, fields, body, headers)¶ Creates list of users with given input array
-
create_users_with_list_input_r
(self, fields, body, headers)¶ Creates list of users with given input array
-
decode
(self, data)¶ abstracted decoding point
Mount your custom function. Focus here is on JSON.
MatLab users may prefer the built in
jsondecode()
while octave users may preferloadjson()
fromjsonlab()
. data could also be a struct with encoding instructions which could be parsed HERE.- Args:
- data: raw MatLab/Octave object
- Returns:
- data_encoded: encoded raw matlab/octave objects
-
delete_order_r
(self, orderId, fields, body, headers)¶ Delete purchase order by ID
-
delete_pet_r
(self, petId, fields, body, headers)¶ Deletes a pet
-
delete_user_r
(self, username, fields, body, headers)¶ Delete user
-
do_call
(self, method, url, body, headers)¶ execute request do external function one central method to dispatched external request essentially wrapping
urlread2()
. but could be replaced.Depending on the method, body will be .. todo:: shouting for switch/case - seperate function
-
encode
(self, data)¶ abstracted encoding point
Mount your custom function. Focus here is on JSON.
MatLab users may prefer the built in
jsonencode()
while octave users may preferjsonsave()
fromjsonlab()
. data could also be a struct with encoding instructions which could be parsed HERE.- Args:
- data: raw matlab/octave objects
- Returns:
- data_encoded: encoded raw matlab/octave objects
-
get_find_pets_by_status_r
(self, fields, body, headers)¶ Finds Pets by status
Finds Pets by tags
-
get_inventory_r
(self, fields, body, headers)¶ Returns pet inventories by status
-
get_login_user_r
(self, fields, body, headers)¶ Logs user into the system
-
get_logout_user_r
(self, fields, body, headers)¶ Logs out current logged in user session
-
get_order_by_id_r
(self, orderId, fields, body, headers)¶ Find purchase order by ID
-
get_pet_by_id_r
(self, petId, fields, body, headers)¶ Find pet by ID
-
get_user_by_name_r
(self, username, fields, body, headers)¶ Get user by user name
-
is_it_time_to_refresh_the_token
(self)¶ check whether
LOGIN_TIMESTAMP
orREFRESH_TIMESTAMP
as surpassed a set duratation which would then require additional action (i.e. re-login or token refreshment)
-
login_with_api
(self, data)¶ login with the target API and save the resonse (JWT token) within a class property
- Args:
- data: login data, externally supplied as a struct
data.username = 'username'; data.password = 'password';
-
param_formatter
(self, fields)¶ return an URL-endoed ‘ready to attach’ querystring create a vector (n*2 x 1) from array (n x 2), if needed
-
post_add_pet_r
(self, fields, body, headers)¶ Add a new pet to the store
-
post_create_user_r
(self, fields, body, headers)¶ Create user
-
post_place_order_r
(self, fields, body, headers)¶ Place an order for a pet
-
post_update_pet_with_form_r
(self, petId, fields, body, headers)¶ Updates a pet in the store with form data
-
post_upload_file_r
(self, petId, fields, body, headers)¶ uploads an image
-
print_property_two
(self)¶ a default getter for a private property
-
property_two
= None¶ None
-
put_update_pet_r
(self, fields, body, headers)¶ Update an existing pet
-
put_update_user_r
(self, username, fields, body, headers)¶ Updated user
-
refresh_the_login
(self)¶
-
search_url
= "'duckduckgo.com'"¶ dummy property
-
static
timestamp
()¶ conveniniece method to return now() as a string
-
static
timestamp2num
(dt)¶ conveniniece method to parse a timestamp
-