Skip to content

Commit

Permalink
Add two test to cover exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Stef Bastiaansen committed Jun 8, 2016
1 parent 18a214f commit 08d5874
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion biblio/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest

from biblio.biblio import publications_by_project, publications_by_organisation, search, publications_by_person, \
publications_by_group, BASE_URL, InvalidID, publication
publications_by_group, BASE_URL, InvalidID, InvalidYear, publication


class TestApi:
Expand Down Expand Up @@ -80,3 +80,11 @@ def test_publication_for_project(self):
items = publications_by_project(self.VALID_PROJECT_ID)
assert isinstance(items, list)
assert len(items) > 10

def test_invalid_ugent_id_should_throw_invalid_year_error(self):
with pytest.raises(InvalidYear):
publications_by_organisation('PP10', 'test')

def test_invalid_ugent_ids_should_throw_invalid_id_error(self):
with pytest.raises(InvalidID):
publications_by_group([self.VALID_UGENT_ID, 'oink'])

0 comments on commit 08d5874

Please sign in to comment.