Skip to content

Commit

Permalink
light refact
Browse files Browse the repository at this point in the history
  • Loading branch information
jaesivsm committed Mar 12, 2017
1 parent e25bcc6 commit 24a3e36
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions src/tests/crawler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,13 @@ def setUp(self):

def _api_req(method, url, **kwargs):
if url.startswith('feed') and len(url) == 6:
class Proxy:
status_code = self.resp_status_code
headers = self.resp_headers
history = []

@classmethod
def raise_for_status(cls):
if self.resp_raise is None:
return
raise self.resp_raise

@property
def content(self):
with open(atom_file_path) as f:
return f.read()

text = content
return Proxy()
with open(atom_file_path) as f:
content = f.read()
resp = Mock(status_code=self.resp_status_code,
headers=self.resp_headers,
content=content, text=content, history=[])
resp.raise_for_status.return_value = self.resp_raise
return resp

url = url.split(conf.API_ROOT)[1].strip('/')
kwargs.pop('allow_redirects', None)
Expand Down

0 comments on commit 24a3e36

Please sign in to comment.