class ApplicationsTest(unittest.TestCase): def setUp(self): self.ap = Applications(usertoken='usertk') def test_instantiate_without_token(self): ap = Applications() with self.assertRaises(ValueError): ap.search('id:xxx') def test_search_invalid_page_size(self): with self.assertRaises(ValueError): [x for x in self.ap.search('issn:1806-9940', pagesize='invalid')] def test_search_invalid_page_size_1(self): """ not between 10 and 100. """ with self.assertRaises(ValueError): [x for x in self.ap.search('issn:1806-9940', pagesize=9)] def test_search_invalid_page_size_2(self): """ not between 10 and 100. """ with self.assertRaises(ValueError): [x for x in self.ap.search('issn:1806-9940', pagesize=101)]
def test_instantiate_without_token(self): ap = Applications() with self.assertRaises(ValueError): ap.search('id:xxx')
def setUp(self): self.ap = Applications(usertoken='usertk')