Example #1
0
 def test_download_zip_file(self, mock_call, mock_unzip, mock_requests):
     mock_response = mock.Mock()
     mock_response.ok = False
     mock_requests.return_value = mock_response
     down1 = update_ipeds.download_zip_file('fake.zip', '/tmp/fakefile.zip')
     self.assertFalse(down1)
     mock_response2 = mock.MagicMock()
     mock_response2.iter_content(chunk_size=None).return_value = ['a', 'b']
     mock_response2.ok = True
     mock_requests.return_value = mock_response2
     down2 = update_ipeds.download_zip_file('fake.zip', '/tmp/fakefile.zip')
     self.assertTrue(mock_unzip.call_count == 1)
     self.assertTrue(mock_call.call_count == 1)
     self.assertTrue(down2)
Example #2
0
 def test_download_zip_file(self, mock_call, mock_unzip, mock_requests):
     mock_response = mock.Mock()
     mock_response.ok = False
     mock_requests.return_value = mock_response
     down1 = update_ipeds.download_zip_file('fake.zip', '/tmp/fakefile.zip')
     self.assertFalse(down1)
     mock_response2 = mock.MagicMock()
     mock_response2.iter_content(chunk_size=None).return_value = ['a', 'b']
     mock_response2.ok = True
     mock_requests.return_value = mock_response2
     down2 = update_ipeds.download_zip_file('fake.zip', '/tmp/fakefile.zip')
     self.assertTrue(mock_unzip.call_count == 1)
     self.assertTrue(mock_call.call_count == 1)
     self.assertTrue(down2)