def testUserContentOnePage(self): result = Mock() result.json.return_value = { 'page':'1', 'pages':'1', 'user_content':['one', 'two', 'three']} #Patch requests.get with patch.object(requests, 'get') as mockGet: mockGet.return_value = result self.assertTrue(bibliocommons.userContent('user') == ['one', 'two', 'three'])
def testUserContentManyPage(self): #Patch requests.get with patch.object(requests, 'get') as mockGet: mockGet.side_effect = self.manycontent_sideeffect self.assertTrue(bibliocommons.userContent('user') == ['1', '2', '3', '4'])