def test_get_changed_since(dbapp): dbapp.engine.execute(packages.insert().values(name="foo1")) dbapp.engine.execute(packages.insert().values(name="foo2")) dbapp.engine.execute(packages.insert().values(name="foo3")) now = datetime.datetime.utcnow() dbapp.engine.execute(journals.insert().values( name="foo2", submitted_date=now - datetime.timedelta(seconds=10), )) dbapp.engine.execute(journals.insert().values( name="foo1", submitted_date=now - datetime.timedelta(seconds=4), )) dbapp.engine.execute(journals.insert().values( name="foo3", submitted_date=now - datetime.timedelta(seconds=3), )) dbapp.engine.execute(journals.insert().values( name="foo1", submitted_date=now, )) since = now - datetime.timedelta(seconds=5) assert dbapp.models.packaging.get_changed_since(since) == ["foo1", "foo3"]
def test_get_projects_with_serial(dbapp): dbapp.engine.execute(journals.insert().values(id=1, name='one')) dbapp.engine.execute(journals.insert().values(id=2, name='two')) dbapp.engine.execute(journals.insert().values(id=3, name='three')) assert dbapp.models.packaging.get_projects_with_serial() == dict(one=1, two=2, three=3)
def test_get_projects_with_serial(dbapp): dbapp.engine.execute(journals.insert().values(id=1, name='one')) dbapp.engine.execute(journals.insert().values(id=2, name='two')) dbapp.engine.execute(journals.insert().values(id=3, name='three')) assert dbapp.db.packaging.get_projects_with_serial() == dict( one=1, two=2, three=3 )
def create(name, delta): dbapp.engine.execute(packages.insert().values(name=name)) dbapp.engine.execute(journals.insert().values(name=name, version=None, submitted_date=now - delta, action="create", id=create.id)) create.id += 1
def create(name, delta): dbapp.engine.execute(packages.insert().values(name=name)) dbapp.engine.execute(journals.insert().values( name=name, version=None, submitted_date=now - delta, action="create", id=create.id, )) create.id += 1
def release(name, version, delta): dbapp.engine.execute(releases.insert().values(name=name, version=version, created=now - delta)) dbapp.engine.execute(journals.insert().values(id=create.id, name=name, version=version, submitted_date=now - delta, action="new release")) create.id += 1
def test_get_changed_since(dbapp): dbapp.engine.execute(packages.insert().values(name="foo1")) dbapp.engine.execute(packages.insert().values(name="foo2")) dbapp.engine.execute(packages.insert().values(name="foo3")) now = datetime.datetime.utcnow() dbapp.engine.execute(journals.insert().values( name="foo2", submitted_date=now - datetime.timedelta(seconds=10), )) dbapp.engine.execute(journals.insert().values( name="foo1", submitted_date=now - datetime.timedelta(seconds=4), )) dbapp.engine.execute(journals.insert().values( name="foo3", submitted_date=now - datetime.timedelta(seconds=3), )) dbapp.engine.execute(journals.insert().values( name="foo1", submitted_date=now, )) since = now - datetime.timedelta(seconds=5) assert dbapp.db.packaging.get_changed_since(since) == ["foo1", "foo3"]
def release(name, version, delta): dbapp.engine.execute(releases.insert().values( name=name, version=version, created=now - delta, )) dbapp.engine.execute(journals.insert().values( id=create.id, name=name, version=version, submitted_date=now - delta, action="new release", )) create.id += 1
def test_get_last_serial(name, serial, dbapp): dbapp.engine.execute(journals.insert().values(id=serial, name=name)) assert dbapp.models.packaging.get_last_serial(name) == serial
def test_get_last_changelog_serial(dbapp): dbapp.engine.execute(journals.insert().values(id=1)) dbapp.engine.execute(journals.insert().values(id=2)) dbapp.engine.execute(journals.insert().values(id=3)) assert dbapp.models.packaging.get_last_changelog_serial() == 3
def test_get_last_changelog_serial(dbapp): dbapp.engine.execute(journals.insert().values(id=1)) dbapp.engine.execute(journals.insert().values(id=2)) dbapp.engine.execute(journals.insert().values(id=3)) assert dbapp.db.packaging.get_last_changelog_serial() == 3