| @@ 774-783 (lines=10) @@ | ||
| 771 | ) |
|
| 772 | self.assertEqual(4, len(res)) |
|
| 773 | ||
| 774 | def test_reraise_requests_exception(self): |
|
| 775 | @urlmatch(netloc=r'(.*\.)?api\.weixin\.qq\.com$') |
|
| 776 | def _wechat_api_mock(url, request): |
|
| 777 | return {'status_code': 404, 'content': '404 not found'} |
|
| 778 | ||
| 779 | try: |
|
| 780 | with HTTMock(_wechat_api_mock): |
|
| 781 | self.client.material.get_count() |
|
| 782 | except WeChatClientException as e: |
|
| 783 | self.assertEqual(404, e.response.status_code) |
|
| 784 | ||
| 785 | def test_wifi_list_shops(self): |
|
| 786 | with HTTMock(wechat_api_mock): |
|
| @@ 270-279 (lines=10) @@ | ||
| 267 | res['mpnews']['articles'][1]['thumb_media_id'] |
|
| 268 | ) |
|
| 269 | ||
| 270 | def test_reraise_requests_exception(self): |
|
| 271 | @urlmatch(netloc=r'(.*\.)?qyapi\.weixin\.qq\.com$') |
|
| 272 | def _wechat_api_mock(url, request): |
|
| 273 | return {'status_code': 404, 'content': '404 not found'} |
|
| 274 | ||
| 275 | try: |
|
| 276 | with HTTMock(_wechat_api_mock): |
|
| 277 | self.client.material.get_count(1) |
|
| 278 | except WeChatClientException as e: |
|
| 279 | self.assertEqual(404, e.response.status_code) |
|
| 280 | ||
| 281 | def test_shakearound_get_shake_info(self): |
|
| 282 | with HTTMock(wechat_api_mock): |
|