コード例 #1
0
 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'])
コード例 #2
0
 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'])