@@ -48,72 +48,3 @@ def find_all_test_cases():
48
48
49
49
50
50
TEST_CASES = list (find_all_test_cases ())
51
-
52
-
53
- def pytest_addoption (parser ):
54
- """Change command line options defaults.
55
-
56
- We want run our tests only in three modes
57
- `live` - interact with an existing API
58
- `record` - interact with an existing API and record the interactions
59
- `replay` - replay previouly recorded interactions with API
60
-
61
- :param parser: A parser object
62
- :type parser: object parser
63
- """
64
- parser .addoption (
65
- "--vcrmode" ,
66
- action = "store" ,
67
- default = "replay" ,
68
- choices = ["replay" , "record" , "live" ],
69
- help = "mode for vcr recording; one of ['replay', 'record', 'live']" ,
70
- )
71
-
72
-
73
- @pytest .fixture
74
- def vcrmode (request ):
75
- """Return vcrmode of a request.
76
-
77
- :param request: A request object
78
- :type request: object request
79
- :return: vcrmode
80
- :rtype: str
81
- """
82
- return request .config .getoption ("vcrmode" )
83
-
84
-
85
- def cassette_name (test_name = None ):
86
- """Generate cassette_name."""
87
- return 'tests/fixtures/{0}.yml' .format (test_name )
88
-
89
-
90
- FILTER_REQUEST_HEADERS = ['Authorization' , 'Cookie' , 'Token' ]
91
- FILTER_RESPONSE_HEADERS = ['Apipie-Checksum' , 'Date' , 'ETag' , 'Server' , 'Set-Cookie' , 'Via' , 'X-Powered-By' , 'X-Request-Id' , 'X-Runtime' ]
92
-
93
-
94
- def filter_response (response ):
95
- """Filter headers before recording.
96
-
97
- :param response: A response object where we want to filter the headers from.
98
- :type response: object response
99
- :return: response
100
- :rtype: object response
101
- """
102
- for header in FILTER_RESPONSE_HEADERS :
103
- # headers should be case insensitive, but for some reason they weren't for me
104
- response ['headers' ].pop (header .lower (), None )
105
- response ['headers' ].pop (header , None )
106
-
107
- return response
108
-
109
-
110
- def filter_request_uri (request ):
111
- """Filter uri before recording.
112
-
113
- :param request: A request object where we want to filter the uri from.
114
- :type request: object request
115
- :return: request
116
- :rtype: object request
117
- """
118
- request .uri = urlunparse (urlparse (request .uri )._replace (netloc = "ipam.example.org" ))
119
- return request
0 commit comments