| Total Complexity | 4 |
| Total Lines | 21 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | # -*- coding: utf-8 -*- |
||
| 17 | class FakeAPITestCase(object): |
||
| 18 | |||
| 19 | def setUp(self): |
||
| 20 | httpretty.enable() |
||
| 21 | |||
| 22 | def tearDown(self): |
||
| 23 | httpretty.disable() |
||
| 24 | httpretty.reset() |
||
| 25 | |||
| 26 | def fake_endpoint(self, api, endpoint, method=httpretty.GET, |
||
| 27 | body=None, status=200): |
||
| 28 | |||
| 29 | if not callable(body): |
||
| 30 | body = json.dumps(body) |
||
| 31 | |||
| 32 | httpretty.register_uri( |
||
| 33 | method, |
||
| 34 | urljoin(api.get_api_url(), endpoint), |
||
| 35 | body=body, |
||
| 36 | content_type='application/json', |
||
| 37 | status=status |
||
| 38 | ) |
||
| 39 |