def test_show_fact_without_author(db): fact = { 'term': 'foo', 'fact': 'foo is bar', } db.facts.find_one.return_value = fact assert facts.show_fact('foo') == 'foo is bar'
def test_show_fact_without_set_time(db): fact = { 'term': 'foo', 'fact': 'foo is bar', 'set_by': 'sduncan', } db.facts.find_one.return_value = fact assert facts.show_fact('foo') == 'foo is bar (sduncan)'
def test_show_fact_set_date_is_datetime(db): fact = { 'term': 'foo', 'fact': 'foo is bar', 'set_by': 'sduncan', 'set_date': datetime(2013, 2, 14, 8, 51), } db.facts.find_one.return_value = fact assert facts.show_fact('foo') == 'foo is bar (sduncan on 02/14/2013 08:51AM)'
def test_show_fact_handles_unicode(db): fact = { 'term': u'☃', 'fact': u'☃ is unicode snowman', 'set_by': 'sduncan', 'set_date': 1360849874.686594, # 02/14/2013 08:51AM } db.facts.find_one.return_value = fact assert facts.show_fact(u'☃') == u'☃ is unicode snowman (sduncan on 02/14/2013 08:51AM)'
def test_show_fact(db): fact = { 'term': 'foo', 'fact': 'foo is bar', 'set_by': 'sduncan', 'set_date': 1360849874.686594, # 02/14/2013 08:51AM } db.facts.find_one.return_value = fact assert facts.show_fact('foo') == 'foo is bar (sduncan on 02/14/2013 08:51AM)'
def test_show_fact_no_record(db): db.facts.find_one.return_value = None assert facts.show_fact('foo') is None