{% if pub['downloads'] %}
Download:
@@ -121,21 +118,24 @@
Existing Publications:
{% for site in pub['sites'] %}{{ SITES[site] }}{% end %}
{% end %}
-
-
-
-
+
+ {% if pub.get('abstract', '') %}
+
Abstract:
{{ pub['abstract'] }}
+ {% end %}
+
+
+
{% end %}
diff --git a/pubs/utils.py b/pubs/utils.py
index 7d1372b..7fa59a3 100644
--- a/pubs/utils.py
+++ b/pubs/utils.py
@@ -77,38 +77,38 @@ async def add_pub(db, title, authors, pub_type, abstract, citation, date, downlo
async def edit_pub(db, mongo_id, title=None, authors=None, pub_type=None, abstract=None, citation=None, date=None, downloads=None, projects=None, sites=None):
match = {'_id': ObjectId(mongo_id)}
update = {}
- if title:
+ if title is not None:
assert isinstance(title, str)
update['title'] = title
- if authors:
+ if authors is not None:
assert isinstance(authors, list)
for a in authors:
assert isinstance(a, str)
update['authors'] = authors
- if pub_type:
+ if pub_type is not None:
assert pub_type in PUBLICATION_TYPES
update['type'] = pub_type
- if abstract:
+ if abstract is not None:
assert isinstance(abstract, str)
update['abstract'] = abstract
- if citation:
+ if citation is not None:
assert isinstance(citation, str)
update['citation'] = citation
- if date:
+ if date is not None:
assert isinstance(date, str)
date_format(date)
update['date'] = date
- if downloads:
+ if downloads is not None:
assert isinstance(downloads, list)
for d in downloads:
assert isinstance(d, str)
update['downloads'] = downloads
- if projects:
+ if projects is not None:
assert isinstance(projects, list)
for p in projects:
assert p in PROJECTS
update['projects'] = projects
- if sites:
+ if sites is not None:
assert isinstance(sites, list)
for s in sites:
assert s in SITES
diff --git a/tests/test_main.py b/tests/test_main.py
index 426b260..9316b45 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -241,3 +241,29 @@ async def test_authors(server):
pubs = await get_pubs(url, params={'authors': 'auth4'})
assert len(pubs) == 0
+
+
+@pytest.mark.asyncio
+async def test_csv(server):
+ db, url = server
+
+ await add_pub(db, title='Test Title1', authors=['auth1'], abstract='',
+ pub_type="journal", citation="TestJournal", date=nowstr(),
+ downloads=[], projects=['icecube'])
+
+ await add_pub(db, title='Test Title2', authors=['auth2'], abstract='',
+ pub_type="proceeding", citation="TestJournal", date=nowstr(),
+ downloads=[], projects=['icecube'])
+
+ await add_pub(db, title='Test Title3', authors=['auth1', 'auth3'], abstract='',
+ pub_type="thesis", citation="TestJournal", date=nowstr(),
+ downloads=[], projects=['icecube'])
+
+ await add_pub(db, title='Test Title4', authors=['auth1', 'auth4'], abstract='the abstract',
+ pub_type="internal", citation="TestReport", date=nowstr(),
+ downloads=[], projects=['icecube'])
+
+ s = AsyncSession(retries=0, backoff_factor=1)
+ r = await asyncio.wrap_future(s.get(url+'/csv'))
+ r.raise_for_status()
+
\ No newline at end of file
diff --git a/tests/test_util.py b/tests/test_util.py
index 824907a..9eb14d5 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -76,30 +76,30 @@ async def test_add_pub_err(mocker, title, authors, pub_type, abstract, citation,
@pytest.mark.parametrize('abstract', ['This is an abstract', '', None])
@pytest.mark.parametrize('citation', ['citation', None])
@pytest.mark.parametrize('date', ['2020-11-03T00:00:00', None])
-@pytest.mark.parametrize('downloads', [['down1', 'down2'], None])
-@pytest.mark.parametrize('projects', [['icecube','hawc'], None])
-@pytest.mark.parametrize('sites', [['icecube', 'wipac'], None])
+@pytest.mark.parametrize('downloads', [['down1', 'down2'], [], None])
+@pytest.mark.parametrize('projects', [['icecube','hawc'], [], None])
+@pytest.mark.parametrize('sites', [['icecube', 'wipac'], [], None])
@pytest.mark.asyncio
async def test_edit_pub(mocker, title, authors, pub_type, abstract, citation, date, downloads, projects, sites):
mongo_id = ObjectId()
args = {}
- if title:
+ if title is not None:
args['title'] = title
- if authors:
+ if authors is not None:
args['authors'] = authors
- if pub_type:
+ if pub_type is not None:
args['type'] = pub_type
- if abstract:
+ if abstract is not None:
args['abstract'] = abstract
- if citation:
+ if citation is not None:
args['citation'] = citation
- if date:
+ if date is not None:
args['date'] = date
- if downloads:
+ if downloads is not None:
args['downloads'] = downloads
- if projects:
+ if projects is not None:
args['projects'] = projects
- if sites:
+ if sites is not None:
args['sites'] = sites
db = mocker.AsyncMock()