Python betamax_serializers.pretty_json.PrettyJSONSerializer() Examples

The following are code examples for showing how to use betamax_serializers.pretty_json.PrettyJSONSerializer(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: zenpy   Author: facetoe   File:    GNU General Public License v3.0 5 votes vote down vote up
def configure():
    config = Betamax.configure()
    config.cassette_library_dir = "tests/test_api/betamax/"
    config.default_cassette_options['record_mode'] = 'once'
    config.default_cassette_options['match_requests_on'] = ['method', 'path_matcher']
    if credentials:
        auth_key = 'token' if 'token' in credentials else 'password'
                "{}/token:{}".format(credentials['email'], credentials[auth_key]).encode('utf-8')
    session = requests.Session()
    credentials['session'] = session
    zenpy_client = Zenpy(**credentials)
    recorder = Betamax(session=session)

    class PathMatcher(URIMatcher):
        I use trial accounts for testing Zenpy and as such the subdomain is always changing.
        This matcher ignores the netloc section of the parsed URL which prevents the tests
        failing when the subdomain is changed.
        name = 'path_matcher'

        def parse(self, uri):
            parse_result = super(PathMatcher, self).parse(uri)
            return parse_result

    return zenpy_client, recorder