Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
41 lines (34 loc) · 1.55 KB

File metadata and controls

41 lines (34 loc) · 1.55 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""Defines all test wide settings and variables"""
from os import environ
from yarl import URL
import json
from domaintools import API, utils
from vcr import VCR
def remove_server(response):
response.get('headers', {}).pop('server', None)
response.get('headers', {}).pop('Server', None)
if 'url' in response:
url = URL(response['url'])
query = dict(url.query)
if 'api_username' in query:
query.update(api_username='test')
if 'api_key' in query:
query.update(api_key='test')
if 'signature' in query:
query.update(signature='test')
response['url'] = str(url.with_query(query))
return response
def filter_patch_parameters(request):
if request.method == 'PATCH' and request.body:
body = json.loads(request.body)
body.pop('api_username', None)
body.pop('api_key', None)
body.pop('signature', None)
body.pop('timestamp', None)
request.body = json.dumps(body).encode('utf-8')
return request
vcr = VCR(before_record_response=remove_server, before_record_request=filter_patch_parameters, filter_query_parameters=['timestamp', 'signature', 'api_username', 'api_key'], filter_post_data_parameters=['timestamp', 'signature', 'api_username', 'api_key'],
cassette_library_dir='tests/fixtures/vcr/', path_transformer=VCR.ensure_suffix('.yaml'),
record_mode='new_episodes')
with vcr.use_cassette('init_user_account'):
api = API(environ.get('TEST_USER', 'test'), environ.get('TEST_KEY', 'test'), always_sign_api_key=True)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.