cannabis_reports.tests package

Submodules

cannabis_reports.tests.api_common module

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

Bases: unittest.case.TestCase

LIMIT_LIST = 10
LIMIT_PAGE = 2
UID = None
endpoint = None
setUp()[source]

cannabis_reports.tests.api_entity module

class cannabis_reports.tests.api_entity.ApiEntityAbstract(methodName='runTest')[source]

Bases: cannabis_reports.tests.api_common.ApiCommon

Tests the AbstractEntityEndpoint API endpoints.

cannabis_reports.tests.api_product module

class cannabis_reports.tests.api_product.ApiProductAbstract(methodName='runTest')[source]

Bases: cannabis_reports.tests.api_common.ApiCommon

Tests the AbstractProductEndpoint API endpoints.

cannabis_reports.tests.test_apis_dispensaries module

class cannabis_reports.tests.test_apis_dispensaries.TestApisDispensaries(methodName='runTest')[source]

Bases: cannabis_reports.tests.api_entity.ApiEntityAbstract

Tests the Dispensaries API endpoint.

UID = 'ca/san-francisco/grass-roots'
setUp()[source]
test_apis_dispensaries_get()[source]

It should not be implemented.

test_apis_dispensaries_get_available()[source]

It should not be implemented for this endpoint.

test_apis_dispensaries_get_edibles()[source]

It should return the edibles for a dispensary.

test_apis_dispensaries_get_extracts()[source]

It should return the extracts for a dispensary.

test_apis_dispensaries_get_products()[source]

It should return the products for a dispensary.

test_apis_dispensaries_get_strains()[source]

It should return the strains for a dispensary.

test_apis_dispensaries_list()[source]

It should parse the response and return the proper object.

cannabis_reports.tests.test_apis_edibles module

class cannabis_reports.tests.test_apis_edibles.TestApisEdibles(methodName='runTest')[source]

Bases: cannabis_reports.tests.api_product.ApiProductAbstract

Tests the Edibles API endpoint.

UID = '4KXM32V9YFC3G2EUNWP400000'
setUp()[source]
test_apis_edibles_get()[source]

It should return the proper singleton.

test_apis_edibles_get_available()[source]

It should return the menu items.

test_apis_edibles_get_effects_flavors()[source]

It should return the effect & flavor profile.

test_apis_edibles_get_producer()[source]

It should return the producer.

test_apis_edibles_get_review()[source]

It should return the reviews.

test_apis_edibles_get_strain()[source]

It should return the strain.

test_apis_edibles_get_user()[source]

It should return the proper user singleton.

test_apis_edibles_list()[source]

It should parse the response and return the proper object.

It should parse the response and return the proper objects.

cannabis_reports.tests.test_apis_extracts module

class cannabis_reports.tests.test_apis_extracts.TestApisExtracts(methodName='runTest')[source]

Bases: cannabis_reports.tests.api_product.ApiProductAbstract

Tests the Extracts API endpoint.

UID = 'QLG39RN2AFPMR6WLTPLW00000'
setUp()[source]
test_apis_extracts_get()[source]

It should return the proper singleton.

test_apis_extracts_get_available()[source]

It should return the menu items.

test_apis_extracts_get_effects_flavors()[source]

It should return the effect & flavor profile.

test_apis_extracts_get_producer()[source]

It should return the producer.

test_apis_extracts_get_review()[source]

It should return the reviews.

test_apis_extracts_get_strain()[source]

It should return the strain.

test_apis_extracts_get_user()[source]

It should return the proper user singleton.

test_apis_extracts_list()[source]

It should parse the response and return the proper object.

It should parse the response and return the proper objects.

cannabis_reports.tests.test_apis_flowers module

class cannabis_reports.tests.test_apis_flowers.TestApisFlowers(methodName='runTest')[source]

Bases: cannabis_reports.tests.api_product.ApiProductAbstract

Tests the Flowers API endpoint.

UID = 'AHZ7H4N6467FVUDY3DAY00000'
setUp()[source]
test_apis_flowers_get()[source]

It should return the proper singleton.

test_apis_flowers_get_available()[source]

It should return the menu items.

test_apis_flowers_get_effects_flavors()[source]

It should return the effect & flavor profile.

test_apis_flowers_get_producer()[source]

It should return the producer.

test_apis_flowers_get_review()[source]

It should return the reviews.

test_apis_flowers_get_strain()[source]

It should return the strain.

test_apis_flowers_get_user()[source]

It should return the proper user singleton.

test_apis_flowers_list()[source]

It should parse the response and return the proper object.

It should parse the response and return the proper objects.

cannabis_reports.tests.test_apis_producer module

class cannabis_reports.tests.test_apis_producer.TestApisProducers(methodName='runTest')[source]

Bases: cannabis_reports.tests.api_entity.ApiEntityAbstract

Tests the Producers API endpoint.

UID = '0000000000L6M7E0000000000'
setUp()[source]
test_apis_producers_get()[source]

It should return the proper singleton.

test_apis_producers_get_available()[source]

It should return the availables for a producer.

test_apis_producers_get_edibles()[source]

It should return the edibles for a producer.

test_apis_producers_get_extracts()[source]

It should return the extracts for a producer.

test_apis_producers_get_products()[source]

It should return the products for a producer.

test_apis_producers_list()[source]

It should parse the response and return the proper object.

cannabis_reports.tests.test_apis_products module

class cannabis_reports.tests.test_apis_products.TestApisProducts(methodName='runTest')[source]

Bases: cannabis_reports.tests.api_product.ApiProductAbstract

Tests the Products API endpoint.

UID = '9XVU7NK3PEGLAJ372X4F00000'
setUp()[source]
test_apis_products_get()[source]

It should return the proper singleton.

test_apis_products_get_available()[source]

It should return the menu items.

test_apis_products_get_effects_flavors()[source]

It should return the effect & flavor profile.

test_apis_products_get_producer()[source]

It should return the producer.

test_apis_products_get_review()[source]

It should return the reviews.

test_apis_products_get_strain()[source]

It should return the strain.

test_apis_products_get_user()[source]

It should return the proper user singleton.

test_apis_products_list()[source]

It should parse the response and return the proper object.

It should parse the response and return the proper objects.

cannabis_reports.tests.test_apis_strains module

class cannabis_reports.tests.test_apis_strains.TestApisStrains(methodName='runTest')[source]

Bases: cannabis_reports.tests.api_product.ApiProductAbstract

Tests the Strains API endpoint.

UID = 'VUJCJ4TYMG000000000000000'
setUp()[source]
test_apis_strains_get()[source]

It should return the proper singleton.

test_apis_strains_get_available()[source]

It should return the menu items.

test_apis_strains_get_children()[source]

It should return the child strains.

test_apis_strains_get_effects_flavors()[source]

It should return the effect & flavor profile.

test_apis_strains_get_genetics()[source]

It should return the parent strains.

test_apis_strains_get_review()[source]

It should return the reviews.

test_apis_strains_get_seed_company()[source]

It should return the seed company.

test_apis_strains_get_user()[source]

It should return the proper user singleton.

test_apis_strains_list()[source]

It should parse the response and return the proper object.

It should parse the response and return the proper objects.

cannabis_reports.tests.test_base_api module

class cannabis_reports.tests.test_base_api.TestApi[source]

Bases: cannabis_reports.base_api.BaseApi

class cannabis_reports.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_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 not found.

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

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

cannabis_reports.tests.test_base_model module

class cannabis_reports.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_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 None and False.

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_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 cannabis_reports.tests.test_base_model.TestModel(**kwargs)[source]

Bases: cannabis_reports.base_model.BaseModel

Required Properties:

  • a_key (String): A key, a unicode string
  • created_at (CustomDateTime): Localized date and time when this record was created., a datetime object
  • 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
  • ucpc (String): UCPC code for this record., a unicode string
  • updated_at (CustomDateTime): Localized date and time when this record was modified., a datetime object
a_key

A key

list

List

list_string

List of Strings

not_a_field = True
sub_instance

Sub Instance

cannabis_reports.tests.test_cannabis_reports module

class cannabis_reports.tests.test_cannabis_reports.TestCannabisReports(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.

cannabis_reports.tests.test_exceptions module

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

Bases: unittest.case.TestCase

test_cannabis_reports_base_exception()[source]

It should include the message in string.

test_cannabis_reports_remote_exception()[source]

It should have the proper str representation.

cannabis_reports.tests.test_request_paginator module

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

Bases: unittest.case.TestCase

REQUEST_TYPES = ['get', 'delete', 'post', 'put']
do_call(request_type='get')[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_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_iter_limit()[source]

It should stop iteration after the correct page.

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