Player

VCR Player plays tapes recorded with httpsrvvcr.recorder using httpsrv.Server provided

class player.Player(server, add_cors=False)[source]

Player wraps the httpsrv.Server and plays perviously recorded vcr tapes on it

Parameters:
  • server (httpsrv.Server) – server thta will be loaded with rules from vcr tapes
  • add_cors (bool) – if True player will add CORS header to all responses
load(tape_file_name)[source]

Decorator that can be used on test functions to read vcr tape from file and load current player with it:

@player.load('path/to/tape.yaml')
def test_should_do_some_vcr(self):
    pass
Parameters:tape_file_name (str) – tape filename to load
play(tape)[source]

Loads the server with rules created from tape passed

Parameters:tape (dict) – vcr tape previously recorded with httpsrvvcr.recorder
player.tape_from_yaml(yaml_text)[source]

Parses yaml tape into python dictionary

Parameters:yaml_text (str) – yaml string to parse