def test_get_files_size_multi_page(self, mock_session): # Give the first of our two page responses a next page URL. p1 = WASAPI_TEXT.replace('"next":null', '"next":"{}?page=2"'.format(WASAPI_URL)) # The value for `count` is pulled from the last page. Though, # in actuality, `count` should be same on all pages. p2 = WASAPI_TEXT.replace('"count":2', '"count":4') responses = [MockResponse200(p1), MockResponse200(p2)] mock_session.return_value.get.side_effect = responses count, total = wc.get_files_size(WASAPI_URL) assert count == 4 assert total == 949365581 * 2
def test_get_files_size_no_files(self, mock_session): mock_session.return_value.get.return_value = MockResponse200(NO_FILES) count, total = wc.get_files_size(WASAPI_URL) assert count == 0 assert total == 0
def test_get_files_size(self, mock_session): mock_session.return_value.get.return_value = MockResponse200() count, total = wc.get_files_size(WASAPI_URL) assert count == 2 assert total == 949365581