def test_claim(db): resp = poems.claim(5, u'unicode snowman ☃', author='me') db.haiku.update.assert_called_with({'message': u'unicode snowman ☃'}, {'$set': { 'author': 'me' }}) assert resp == u'me has claimed the line: unicode snowman ☃'
def test_claim_unknown_line(db): db.haiku.update.side_effect = Exception resp = poems.claim(5, u'unicode snowman ☃', author='me') assert resp == "Sorry, I don't know that line."
def test_claim(db): resp = poems.claim(5, u'unicode snowman ☃', author='me') db.haiku.update.assert_called_with({'message': u'unicode snowman ☃'}, {'$set': {'author': 'me'}}) assert resp == u'me has claimed the line: unicode snowman ☃'