Esempio n. 1
0
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)]
Esempio n. 2
0
 def test_instantiate_without_token(self):
     
     ap = Applications()
     with self.assertRaises(ValueError):
         ap.search('id:xxx')
Esempio n. 3
0
 def setUp(self):
     self.ap = Applications(usertoken='usertk')