示例#1
0
async def test_project(server):
    db, url = server

    await add_pub(db,
                  title='Test Title',
                  authors=['auth'],
                  pub_type="journal",
                  citation="TestJournal",
                  date=nowstr(),
                  downloads=[],
                  projects=['icecube'])

    await add_pub(db,
                  title='Test Title2',
                  authors=['auth'],
                  pub_type="journal",
                  citation="TestJournal",
                  date=nowstr(),
                  downloads=[],
                  projects=['hawc'])

    pubs = await get_pubs(url, params={'projects': 'hawc'})
    assert len(pubs) == 1
    assert pubs[0].select('.title')[0].string == 'Test Title2'
    assert pubs[0].select('.project')[0].string == 'HAWC'
示例#2
0
async def test_title(server):
    db, url = server

    await add_pub(db,
                  title='Test Title1',
                  authors=['auth'],
                  pub_type="journal",
                  citation="TestJournal",
                  date=nowstr(),
                  downloads=[],
                  projects=['icecube'])

    await add_pub(db,
                  title='Test Title2',
                  authors=['auth'],
                  pub_type="proceeding",
                  citation="TestJournal",
                  date=nowstr(),
                  downloads=[],
                  projects=['icecube'])

    await add_pub(db,
                  title='Test Title3',
                  authors=['auth'],
                  pub_type="thesis",
                  citation="TestJournal",
                  date=nowstr(),
                  downloads=[],
                  projects=['icecube'])

    pubs = await get_pubs(url, params={'search': 'title1'})
    assert len(pubs) == 1
    assert pubs[0].select('.title')[0].string == 'Test Title1'
示例#3
0
async def test_multiple_pubs(server):
    db, url = server

    await add_pub(db,
                  title='Test Title',
                  authors=['auth'],
                  pub_type="journal",
                  citation="TestJournal",
                  date=nowstr(),
                  downloads=[],
                  projects=['icecube'])

    await add_pub(db,
                  title='Test Title2',
                  authors=['auth'],
                  pub_type="journal",
                  citation="TestJournal",
                  date=nowstr(),
                  downloads=[],
                  projects=['icecube'])

    await add_pub(db,
                  title='Test Title3',
                  authors=['auth'],
                  pub_type="journal",
                  citation="TestJournal",
                  date=nowstr(),
                  downloads=[],
                  projects=['icecube'])

    pubs = await get_pubs(url)
    assert len(pubs) == 3
    # order by reversed date
    assert pubs[0].select('.title')[0].string == 'Test Title3'
    assert pubs[1].select('.title')[0].string == 'Test Title2'
    assert pubs[2].select('.title')[0].string == 'Test Title'
示例#4
0
async def test_single_pub(server):
    db, url = server

    await add_pub(db,
                  title='Test Title',
                  authors=['auth'],
                  pub_type="journal",
                  citation="TestJournal",
                  date=nowstr(),
                  downloads=[],
                  projects=['icecube'])

    pubs = await get_pubs(url)
    assert len(pubs) == 1
    assert pubs[0].select('.title')[0].string == 'Test Title'
    assert pubs[0].select('.author')[0].string == 'auth'
    assert pubs[0].select('.project')[0].string == 'IceCube'