Example #1
0
def test_add_fact(time, db):
    time.time.return_value = 1
    db.facts.find.return_value = db
    db.count.return_value = 0
    facts.add_fact('foo', 'bar', 'baz')
    db.facts.insert.assert_called_with({
        'term': 'foo',
        'fact': 'bar',
        'set_by': 'baz',
        'set_date': 1,
    })
Example #2
0
def test_add_fact_does_nothing_when_found(db):
    db.facts.find.return_value = db
    db.count.return_value = 1
    facts.add_fact('foo', 'bar', 'baz')
    assert not db.facts.insert.called