Exemple #1
0
 def test_result_on_non_existent_pkg_path(self):
     conf = config.Config('')
     conf.rewrite_config_opts = unittest.mock.Mock()
     conf.config_opts['verify_required'] = False
     result = pkg_integrity.from_disk('http://nokey.com/package.tar.gz',
                                      'NonExistentPKG.tar.gz',
                                      'NonExistentKey.asc', conf)
     self.assertIsNone(result)
Exemple #2
0
 def test_from_disk(self):
     with tempfile.TemporaryDirectory() as tmpd:
         out_file = os.path.join(tmpd, os.path.basename(PACKAGE_URL))
         out_key = out_file + '.asc'
         pkg_integrity.attempt_to_download(PACKAGE_URL, out_file)
         pkg_integrity.attempt_to_download(PACKAGE_URL + '.asc', out_key)
         result = pkg_integrity.from_disk(PACKAGE_URL, out_file, out_key)
         self.assertTrue(result)
 def test_from_disk(self):
     with tempfile.TemporaryDirectory() as tmpd:
         shutil.copy(os.path.join(TESTKEYDIR, "023A4420C7EC6914.pkey"),
                     tmpd)
         out_file = os.path.join(tmpd, os.path.basename(PACKAGE_URL))
         out_key = out_file + ".asc"
         pkg_integrity.download_file(PACKAGE_URL, tmpd)
         pkg_integrity.download_file(PACKAGE_URL + ".asc", tmpd)
         result = pkg_integrity.from_disk(PACKAGE_URL, out_file, out_key)
         self.assertTrue(result)
Exemple #4
0
 def test_from_disk(self):
     with tempfile.TemporaryDirectory() as tmpd:
         conf = config.Config(tmpd)
         conf.rewrite_config_opts = unittest.mock.Mock()
         conf.config_opts['verify_required'] = False
         shutil.copy(os.path.join(TESTKEYDIR, "023A4420C7EC6914.pkey"),
                     tmpd)
         out_file = os.path.join(tmpd, os.path.basename(PACKAGE_URL))
         out_key = out_file + ".asc"
         shutil.copy(os.path.join(TESTDIR, os.path.basename(PACKAGE_URL)),
                     tmpd)
         shutil.copy(
             os.path.join(TESTDIR, os.path.basename(PACKAGE_URL)) + ".asc",
             tmpd)
         result = pkg_integrity.from_disk(PACKAGE_URL, out_file, out_key,
                                          conf)
         self.assertTrue(result)
Exemple #5
0
 def test_result_on_non_existent_pkg_path(self):
     result = pkg_integrity.from_disk('http://nokey.com/package.tar.gz',
                                      'NonExistentPKG.tar.gz',
                                      'NonExistentKey.asc')
     self.assertIsNone(result)