Skip to content

Commit

Permalink
Alter test attachment doc link mode
Browse files Browse the repository at this point in the history
This causes tests related to #75 to pass again
  • Loading branch information
urschrei committed Nov 30, 2018
1 parent 65da8ef commit 1670154
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions pyzotero/zotero.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,13 @@ def wrapped_f(self, *args, **kwargs):
return retrieved.content
# no need to do anything special, return JSON
else:
return retrieved.json()

# is this a snapshot though?
retr = retrieved.json()
# I know, I know
if isinstance(retr, dict) and retr.get('data', {}).get('linkMode', {}) == u"imported_url":
return retrieved.content
else:
return retr
return wrapped_f


Expand Down
2 changes: 1 addition & 1 deletion test/api_responses/attachments_doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"itemType": "attachment",
"title": "1641 Depositions",
"accessDate": "2012-01-11T19:54:47Z",
"linkMode": "imported_url",
"linkMode": "idk",
"charset": "utf-8",
"relations": {},
"filename": "project-conservation.html",
Expand Down

0 comments on commit 1670154

Please sign in to comment.