<s> import base64 <EOL> import betamax <EOL> import os <EOL> import pytest <EOL> from betamax_matchers import json_body <EOL> credentials = [ os . environ . get ( '<STR_LIT>' , '<STR_LIT:foo>' ) . encode ( ) , <EOL> os . environ . get ( '<STR_LIT>' , '<STR_LIT:bar>' ) . encode ( ) ] <EOL> betamax . Betamax . register_request_matcher ( json_body . JSONBodyMatcher ) <EOL> with betamax . Betamax . configure ( ) as config : <EOL> config . cassette_library_dir = '<STR_LIT>' <EOL> record_mode = '<STR_LIT>' if os . environ . get ( '<STR_LIT>' ) else '<STR_LIT>' <EOL> config . default_cassette_options [ '<STR_LIT>' ] = record_mode <EOL> config . define_cassette_placeholder ( <EOL> '<STR_LIT>' , <EOL> os . environ . get ( '<STR_LIT>' , '<STR_LIT:x>' * <NUM_LIT:20> ) <EOL> ) <EOL> config . default_cassette_options [ '<STR_LIT>' ] . append ( '<STR_LIT>' ) <EOL> config . define_cassette_placeholder ( <EOL> '<STR_LIT>' , <EOL> base64 . b64encode ( b'<STR_LIT::>' . join ( credentials ) ) . decode ( ) <EOL> ) <EOL> @ pytest . fixture <EOL> def betamax_simple_body ( request ) : <EOL> """<STR_LIT>""" <EOL> request . cls . betamax_simple_body = { <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:body>' ] <EOL> } <EOL> @ pytest . fixture <EOL> def enterprise_url ( request ) : <EOL> """<STR_LIT>""" <EOL> request . cls . enterprise_url = '<STR_LIT>' <EOL> class IfNoneMatchMatcher ( betamax . BaseMatcher ) : <EOL> name = '<STR_LIT>' <EOL> def match ( self , request , recorded_request ) : <EOL> request_header = request . headers . get ( '<STR_LIT>' ) <EOL> recorded_header = recorded_request [ '<STR_LIT>' ] . get ( '<STR_LIT>' ) <EOL> matches = True if request_header == recorded_header else False <EOL> return matches <EOL> betamax . Betamax . register_request_matcher ( IfNoneMatchMatcher ) </s>
