Show More
@@ -134,6 +134,19 b' def vcrcommand(name, flags, spec, helpca' | |||
|
134 | 134 | r2params = r2.body.split(b'&') |
|
135 | 135 | return set(r1params) == set(r2params) |
|
136 | 136 | |
|
137 | def sanitiserequest(request): | |
|
138 | request.body = re.sub( | |
|
139 | r'cli-[a-z0-9]+', | |
|
140 | r'cli-hahayouwish', | |
|
141 | request.body | |
|
142 | ) | |
|
143 | return request | |
|
144 | ||
|
145 | def sanitiseresponse(response): | |
|
146 | if r'set-cookie' in response[r'headers']: | |
|
147 | del response[r'headers'][r'set-cookie'] | |
|
148 | return response | |
|
149 | ||
|
137 | 150 | def decorate(fn): |
|
138 | 151 | def inner(*args, **kwargs): |
|
139 | 152 | cassette = pycompat.fsdecode(kwargs.pop(r'test_vcr', None)) |
@@ -144,6 +157,8 b' def vcrcommand(name, flags, spec, helpca' | |||
|
144 | 157 | import vcr.stubs as stubs |
|
145 | 158 | vcr = vcrmod.VCR( |
|
146 | 159 | serializer=r'json', |
|
160 | before_record_request=sanitiserequest, | |
|
161 | before_record_response=sanitiseresponse, | |
|
147 | 162 | custom_patches=[ |
|
148 | 163 | (urlmod, r'httpconnection', |
|
149 | 164 | stubs.VCRHTTPConnection), |
@@ -15,8 +15,8 b'' | |||
|
15 | 15 | > hgphab.prefix = phab.mercurial-scm.org |
|
16 | 16 | > # When working on the extension and making phabricator interaction |
|
17 | 17 | > # changes, edit this to be a real phabricator token. When done, edit |
|
18 | > # it back, and make sure to also edit your VCR transcripts to match | |
|
19 | > # whatever value you put here. | |
|
18 | > # it back. The VCR transcripts will be auto-sanitised to replace your real | |
|
19 | > # token with this value. | |
|
20 | 20 | > hgphab.phabtoken = cli-hahayouwish |
|
21 | 21 | > EOF |
|
22 | 22 | $ VCR="$TESTDIR/phabricator" |
General Comments 0
You need to be logged in to leave comments.
Login now