(url, request)
| 15 | |
| 16 | @urlmatch(netloc=r'(.*\.)?api\.weixin\.qq\.com$') |
| 17 | def wechat_api_mock(url, request): |
| 18 | path = url.path.replace('/cgi-bin/component/', '').replace('/', '_') |
| 19 | res_file = os.path.join(_FIXTURE_PATH, '%s.json' % path) |
| 20 | content = { |
| 21 | 'errcode': 99999, |
| 22 | 'errmsg': 'can not find fixture %s' % res_file, |
| 23 | } |
| 24 | headers = { |
| 25 | 'Content-Type': 'application/json' |
| 26 | } |
| 27 | try: |
| 28 | with open(res_file, 'rb') as f: |
| 29 | content = json.loads(f.read().decode('utf-8')) |
| 30 | except (IOError, ValueError): |
| 31 | pass |
| 32 | return response(200, content, headers, request=request) |
| 33 | |
| 34 | |
| 35 | class WeChatComponentTestCase(unittest.TestCase): |
nothing calls this directly
no test coverage detected
searching dependent graphs…