Example #1
0
def test_upgrade(tmpdir):
    db_file = tmpdir.join('db.json')
    db_file.write(v1_0)

    # Run upgrade
    assert migrate(str(db_file)) is True
    db = TinyDB(str(db_file))

    assert db.count(where('key') == 'value') == 1
Example #2
0
def test_no_upgrade_needed(tmpdir):
    db_file = tmpdir.join('db.json')
    with TinyDB(str(db_file)) as db:
        db.insert({'val': 1})

    assert migrate(str(db_file)) is False