Skip to content

Commit

Permalink
Update readme tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Kessinger committed Sep 30, 2017
1 parent 7c58f59 commit c4e3a86
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
9 changes: 4 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ Example
return str(item['pk'])
def key(self, item):
return convert_datetime_to_str(item['created_at'])
return [
[convert_datetime_to_str(item['created_at'])]
]
class BookmarkManager(CManager):
Expand All @@ -88,12 +90,9 @@ Example
await bookmark_manager.add_item(bookmark)
items = await bookmark_manager.every.get_items()
resp = await bookmark_manager.every.get_items()
assert resp['items'][0]['link'] == 'http://google.com'
loop = asyncio.get_event_loop()
loop.run_until_complete(demo())
2 changes: 1 addition & 1 deletion ssshelf/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.5"
__version__ = "0.1.0"
22 changes: 12 additions & 10 deletions tests/test_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,29 @@ def get_pk(self, item):
return str(item['pk'])

def key(self, item):
return convert_datetime_to_str(item['created_at'])
return [
[convert_datetime_to_str(item['created_at'])]
]


class BookmarkManager(CManager):
item_manager = Bookmark()
every = AllBookmarks()

async def demo():
bookmark_manager = BookmarkManager(InMemoryStorage())
bookmark_manager = BookmarkManager(InMemoryStorage())

bookmark = {
'pk': simpleflake.simpleflake(),
'link': 'http://google.com',
'created_at': datetime.utcnow()
}
bookmark = {
'pk': simpleflake.simpleflake(),
'link': 'http://google.com',
'created_at': datetime.utcnow()
}

await bookmark_manager.add_item(bookmark)
await bookmark_manager.add_item(bookmark)

resp = await bookmark_manager.every.get_items()
resp = await bookmark_manager.every.get_items()

assert resp['items'][0]['link'] == 'http://google.com'
assert resp['items'][0]['link'] == 'http://google.com'


def test_readme(loop):
Expand Down

0 comments on commit c4e3a86

Please sign in to comment.