helpscout.tests package

Submodules

helpscout.tests.api_common module

class helpscout.tests.api_common.ApiCommon(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

helpscout.tests.test_apis_conversations module

class helpscout.tests.test_apis_conversations.TestApisConversations(methodName='runTest')[source]

Bases: helpscout.tests.api_common.ApiCommon

Tests the Conversations API endpoint.

setUp()[source]
test_apis_conversations_create()[source]

It should create and return a Conversation.

test_apis_conversations_create_attachment()[source]

It should create and return the Attachment.

test_apis_conversations_create_thread()[source]

It should create the thread and return the conversation.

test_apis_conversations_delete()[source]

It should delete the conversation.

test_apis_conversations_delete_attachment()[source]

It should return None after a success.

test_apis_conversations_find_customer()[source]

It should only return conversations for the customer.

test_apis_conversations_find_user()[source]

It should only return conversations for the user.

test_apis_conversations_get()[source]

It should return the conversation.

test_apis_conversations_get_attachment_data()[source]

It should return the proper attachment.

test_apis_conversations_list()[source]

It should list the conversations in the mailbox.

test_apis_conversations_list_folder()[source]

It should return conversations specific to a folder.

It should search for and return the conversation.

test_apis_conversations_update()[source]

It should update the conversation.

test_apis_conversations_update_thread()[source]

It should update the thread.

helpscout.tests.test_apis_customers module

class helpscout.tests.test_apis_customers.TestApisCustomers(methodName='runTest')[source]

Bases: helpscout.tests.api_common.ApiCommon

Tests the Customers API endpoint.

setUp()[source]
test_apis_customers_create()[source]

It should create and return a Customer.

test_apis_customers_delete()[source]

It should not be implemented.

test_apis_customers_get()[source]

It should return the customer.

test_apis_customers_list()[source]

It should list the customers in the mailbox.

It should search for and return the customer.

test_apis_customers_update()[source]

It should update the customer.

helpscout.tests.test_apis_mailboxes module

class helpscout.tests.test_apis_mailboxes.TestApisMailboxes(methodName='runTest')[source]

Bases: helpscout.tests.api_common.ApiCommon

Tests the Mailboxes API endpoint.

setUp()[source]
test_apis_mailboxes_create()[source]

It should not be implemented.

test_apis_mailboxes_delete()[source]

It should not be implemented.

test_apis_mailboxes_get()[source]

It should return the mailbox.

test_apis_mailboxes_list()[source]

It should list the mailboxes in the mailbox.

It should not be implemented.

test_apis_mailboxes_update()[source]

It should not be implemented.

helpscout.tests.test_apis_tags module

class helpscout.tests.test_apis_tags.TestApisTags(methodName='runTest')[source]

Bases: helpscout.tests.api_common.ApiCommon

Tests the Tags API endpoint.

setUp()[source]
test_apis_tags_create()[source]

It should not be implemented.

test_apis_tags_delete()[source]

It should not be implemented.

test_apis_tags_get()[source]

It should not be implemented.

test_apis_tags_list()[source]

It should list the tags in the tag.

It should not be implemented.

test_apis_tags_update()[source]

It should not be implemented.

helpscout.tests.test_apis_teams module

class helpscout.tests.test_apis_teams.TestApisTeams(methodName='runTest')[source]

Bases: helpscout.tests.api_common.ApiCommon

Tests the Teams API endpoint.

setUp()[source]
test_apis_teams_create()[source]

It should not be implemented.

test_apis_teams_delete()[source]

It should not be implemented.

test_apis_teams_get()[source]

It should return the team.

test_apis_teams_get_members()[source]

It should get the team members.

test_apis_teams_list()[source]

It should list the teams in the team.

It should not be implemented.

test_apis_teams_update()[source]

It should not be implemented.

helpscout.tests.test_apis_users module

class helpscout.tests.test_apis_users.TestApisUsers(methodName='runTest')[source]

Bases: helpscout.tests.api_common.ApiCommon

Tests the Users API endpoint.

setUp()[source]
test_apis_users_create()[source]

It should not be implemented.

test_apis_users_delete()[source]

It should not be implemented.

test_apis_users_find_in_mailbox()[source]

It should return the users associated with the mailbox.

test_apis_users_get()[source]

It should return the user.

test_apis_users_get_me()[source]

It should return the current users.

test_apis_users_list()[source]

It should list the users in the user.

It should not be implemented.

test_apis_users_update()[source]

It should not be implemented.

helpscout.tests.test_auth_proxy module

class helpscout.tests.test_auth_proxy.ApiClass[source]

Bases: object

classmethod not_proxied(*args, **kwargs)[source]
classmethod proxied(session=None)[source]
exception helpscout.tests.test_auth_proxy.EndTestException(*args, **kwargs)[source]

Bases: exceptions.Exception

class helpscout.tests.test_auth_proxy.TestAuthProxy(methodName='runTest')[source]

Bases: unittest.case.TestCase

SESSION = 'session'
new_proxy(session='session', proxy_class=<class 'helpscout.tests.test_auth_proxy.ApiClass'>)[source]
test_getattr_injects_session()[source]

It should inject the session into the proxied method.

test_getattr_whitelist()[source]

It should not proxy methods that are in the whitelist.

test_init_bad_api_class()[source]

It should assert API class is a class.

test_init_sets_proxy_class()[source]

It should set the proxy_class instance var.

test_init_sets_session()[source]

It should set the session instance var.

helpscout.tests.test_base_api module

class helpscout.tests.test_base_api.TestApi[source]

Bases: helpscout.base_api.BaseApi

class helpscout.tests.test_base_api.TestBaseApi(methodName='runTest')[source]

Bases: unittest.case.TestCase

DATA = {'test': 1234}
ENDPOINT = '/endpoint'
REQUEST_TYPE = 'post'
new_api(endpoint='/endpoint', data={'test': 1234}, request_type='post', singleton=False, session=None, out_type=None)[source]
test_base_api_iterates_paginator(*args, **keywargs)[source]

It should pass iteration to the paginator.

test_get_search_domain_domain()[source]

It should return the input if it is a Domain obj.

test_get_search_domain_tuple()[source]

It should return the input if it is a Domain obj.

test_new()[source]

It should return a new TestApi instance.

test_new_object()[source]

It should return the proper object.

test_new_paginator()[source]

It should return a new API object with a paginator.

test_new_paginator_create()[source]

It should create the paginator with the proper args.

test_new_paginator_singleton(*args, **keywargs)[source]

It should return the record if singleton and found.

test_new_paginator_singleton_none(*args, **keywargs)[source]

It should return None if singleton and return value is None.

test_new_paginator_singleton_not_found(*args, **keywargs)[source]

It should return None if singleton and not found.

test_new_paginator_singleton_out_type(*args, **keywargs)[source]

It should return an object of the correct type if defined.

helpscout.tests.test_base_model module

class helpscout.tests.test_base_model.TestBaseModel(methodName='runTest')[source]

Bases: unittest.case.TestCase

new_record()[source]
setUp()[source]
test_dict_lookup_exist()[source]

It should return the attribute value when it exists.

test_dict_lookup_no_exist()[source]

It should raise a KeyError when the attribute isn’t a field.

test_dict_set_exist()[source]

It should set the attribute via the items.

test_dict_set_no_exist()[source]

It should raise a KeyError and not change the non-field.

test_from_api_camel_to_snake()[source]

It should call the init with snake cased keys.

test_from_api_color_none()[source]

It should parse ‘none’ API value in Color property as lightgrey.

test_from_api_invalid_attribute()[source]

It should remove any invalid attributes.

test_from_api_list()[source]

It should properly convert lists of instances.

test_from_api_list_no_model()[source]

Test from_api when there is a list of non-property objects.

test_from_api_new_instance()[source]

It should return a new instance of the class.

test_from_api_sub_instance()[source]

It should properly instantiate sub-instances.

test_get_exist()[source]

It should return the attribute if it exists.

test_get_no_exist()[source]

It should return the default if the attribute doesn’t exist.

test_get_non_empty_vals()[source]

It should return the dict without NoneTypes.

test_parse_property_invalid_property()[source]

It should raise an exception if property name is invalid.

test_to_api_camel_case()[source]

It should properly camel case the API args.

test_to_api_date()[source]

It should return the serialized datetime.

test_to_api_instance()[source]

It should properly convert sub-instances to dict.

test_to_api_list()[source]

It should properly convert sub-instances within lists props.

test_to_api_list_string()[source]

It should properly handle naive lists.

class helpscout.tests.test_base_model.TestModel(**kwargs)[source]

Bases: helpscout.base_model.BaseModel

Required Properties:

  • a_key (String): A key, a unicode string
  • color (Color): Color, a color
  • date (DateTime): DateTime, a datetime object
  • id (Integer): Unique identifier, an integer
  • list (a list of BaseModel): List, a list (each item is an instance of BaseModel)
  • list_string (a list of String): List of Strings, a list (each item is a unicode string)
  • sub_instance (BaseModel): Sub Instance, an instance of BaseModel
a_key

A key

color

Color

date

DateTime

list

List

list_string

List of Strings

not_a_field = True
sub_instance

Sub Instance

helpscout.tests.test_domain module

class helpscout.tests.test_domain.TestDomain(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_from_tuple()[source]

It should return the proper domain.

test_init_adds_queries()[source]

It should add queries if defined.

helpscout.tests.test_exceptions module

class helpscout.tests.test_exceptions.TestExceptions(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_helpscout_base_exception()[source]

It should include the message in string.

test_helpscout_remote_exception()[source]

It should have the proper str representation.

helpscout.tests.test_helpscout module

class helpscout.tests.test_helpscout.TestHelpScout(methodName='runTest')[source]

Bases: unittest.case.TestCase

API_KEY = 'test key'
setUp()[source]
test_api_auth_proxy()[source]

It should wrap the APIs in an AuthProxy.

test_api_instance_attributes()[source]

It should properly set all of the API instance attributes.

test_init_session()[source]

It should build a session with the proper authentication.

test_load_apis()[source]

It should load all available APIs.

helpscout.tests.test_helpscout_web_hook module

class helpscout.tests.test_helpscout_web_hook.TestHelpScoutWebHook(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_create()[source]

It should pass self through to the WebHook endpoint create.

test_receive_returns_event()[source]

Valid receive should return instantiated web hook event.

test_receive_str_invalid()[source]

It should raise on invalid signature from data string.

test_validate_signature_invalid()[source]

It should return False for invalid signature.

test_validate_signature_valid()[source]

It should return True for valid signature.

helpscout.tests.test_helpscout_web_hook_event module

class helpscout.tests.test_helpscout_web_hook_event.TestHelpScoutWebHookEvent(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_record_from_data()[source]

It should create a correct record from the API data.

test_record_from_record()[source]

It should pass through a pre-existing record.

helpscout.tests.test_model_person module

class helpscout.tests.test_model_person.TestPerson(methodName='runTest')[source]

Bases: unittest.case.TestCase

new_record(type)[source]
test_customer_person_type_customer()[source]

It should properly set customer_person_type to True when person type is ‘customer’

test_customer_person_type_setter_false()[source]

It should properly set type to ‘user’ when customer_person_type is set as False

test_customer_person_type_setter_true()[source]

It should properly set type to ‘customer’ when customer_person_type is set as True

test_customer_person_type_user()[source]

It should properly set customer_person_type to False when person type is not ‘customer’

helpscout.tests.test_request_paginator module

class helpscout.tests.test_request_paginator.TestRequestPaginator(methodName='runTest')[source]

Bases: unittest.case.TestCase

REQUEST_TYPES = ['get', 'delete', 'post', 'put']
do_call(request_type='get', responses=None)[source]
mock_session(*args, **kwds)[source]
setUp()[source]
test_call_get()[source]

It should get when the request type is GET.

test_call_post()[source]

It should post when the request type is POST.

test_delete_return_null_response_body()[source]

The delete return should be None if response body is null.

test_get_gets()[source]

It should call the session with proper args.

test_init_attrs()[source]

It should correctly assign instance attributes.

test_init_session(*args, **keywargs)[source]

It should initialize a requests session.

test_iter()[source]

It should iterate until the end & yield data.

test_returns()[source]

The returns should all return properly.

test_session_calls()[source]

The calls should all be handled properly (tests all but GET).

Module contents

class helpscout.tests.BaseModel(**kwargs)[source]

Bases: properties.base.base.HasProperties

This is the model that all other models inherit from.

It provides some convenience functions, and the standard id property.

Required Properties:

  • id (Integer): Unique identifier, an integer
id

Unique identifier