Beispiel #1
0
def get_complete_mar(url, mar_hash, output_file):
    """ Return binary string if no output_file specified """
    log.info('Downloading complete MAR %s with mar_hash %s', url, mar_hash)

    if url.startswith('http://') or url.startswith('https://'):
        fetch.download_mar(url, mar_hash, output_file)
        cache.save(output_file, 'complete', mar_hash, isfilename=True)
    else:
        cache.retrieve_to_file('complete', mar_hash, output_file=output_file)

    log.info('Satisfied request for complete MAR %s with mar_hash %s', url,
             mar_hash)
Beispiel #2
0
def get_complete_mar(url, mar_hash, output_file):
    """ Return binary string if no output_file specified """
    log.info('Downloading complete MAR %s with mar_hash %s', url, mar_hash)

    if url.startswith('http://') or url.startswith('https://'):
        fetch.download_mar(url, mar_hash, output_file)
        cache.save(output_file, 'complete', mar_hash, isfilename=True)
    else:
        cache.retrieve_to_file('complete', mar_hash, output_file=output_file)

    log.info('Satisfied request for complete MAR %s with mar_hash %s', url,
             mar_hash)
 def test_existing_file_save(self):
     fetch.download_mar(TEST_URL, TEST_SHA512, output_file=self.temp_filepath)
     self.assertTrue(os.path.exists(self.temp_filepath))
 def test_correct_download(self):
     self.assertEqual(None, fetch.download_mar(TEST_URL, TEST_SHA512, output_file=self.temp_filepath))
 def test_existing_file_save(self):
     fetch.download_mar(TEST_URL,
                        TEST_SHA512,
                        output_file=self.temp_filepath)
     self.assertTrue(os.path.exists(self.temp_filepath))
 def test_correct_download(self):
     self.assertEqual(
         None,
         fetch.download_mar(TEST_URL,
                            TEST_SHA512,
                            output_file=self.temp_filepath))