コード例 #1
0
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"]
コード例 #2
0
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)
コード例 #3
0
ファイル: test_db.py プロジェクト: b-jazz/warehouse
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
    )
コード例 #4
0
 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
コード例 #5
0
ファイル: test_db.py プロジェクト: b-jazz/warehouse
 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
コード例 #6
0
 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
コード例 #7
0
ファイル: test_db.py プロジェクト: b-jazz/warehouse
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"]
コード例 #8
0
ファイル: test_db.py プロジェクト: b-jazz/warehouse
 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
コード例 #9
0
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
コード例 #10
0
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
コード例 #11
0
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
コード例 #12
0
ファイル: test_db.py プロジェクト: b-jazz/warehouse
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