Пример #1
0
def owner(session, request):
    """Create an account for a test."""
    owner = Account.find_or_create("invenio", token="DEADBEEF")

    def teardown():
        session.delete(owner)
        session.commit()

    request.addfinalizer(teardown)
    return owner
Пример #2
0
def accounts(session, request):
    names = "invenio", "test", "bob"

    a = []
    for name in names:
        a.append(Account.find_or_create(name))

    def teardown():
        for account in a:
            session.delete(account)
        session.commit()

    request.addfinalizer(teardown)
    return a