コード例 #1
0
ファイル: core.py プロジェクト: harsimrans/build-funsize
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)
コード例 #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)
コード例 #3
0
 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))
コード例 #4
0
 def test_correct_download(self):
     self.assertEqual(None, fetch.download_mar(TEST_URL, TEST_SHA512, output_file=self.temp_filepath))
コード例 #5
0
 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))
コード例 #6
0
 def test_correct_download(self):
     self.assertEqual(
         None,
         fetch.download_mar(TEST_URL,
                            TEST_SHA512,
                            output_file=self.temp_filepath))