def test_non_matchingsig(self): with tempfile.TemporaryDirectory() as tmpd: out_file = os.path.join(tmpd, os.path.basename(PACKAGE_URL)) f = open(out_file, 'wb') f.write(b'made up date that will fail check') f.close() with self.assertRaises(SystemExit) as a: pkg_integrity.from_url(PACKAGE_URL, tmpd) self.assertEqual(a.exception.code, 1)
def test_non_matchingsha(self): with tempfile.TemporaryDirectory() as tmpd: out_file = os.path.join(tmpd, os.path.basename(GEM_PKT)) f = open(out_file, 'wb') f.write(b'this is made up data that will force a failure') f.close() with self.assertRaises(SystemExit) as a: pkg_integrity.from_url(GEM_PKT, tmpd) self.assertEqual(a.exception.code, 1)
def test_from_url(self): with tempfile.TemporaryDirectory() as tmpd: out_file = os.path.join(tmpd, os.path.basename(PACKAGE_URL)) pkg_integrity.attempt_to_download(PACKAGE_URL, out_file) out_file1 = os.path.join(tmpd, os.path.basename(XATTR_PKT_URL)) pkg_integrity.attempt_to_download(XATTR_PKT_URL, out_file1) result = pkg_integrity.from_url(PACKAGE_URL, tmpd) self.assertTrue(result)
def test_from_url(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)) pkg_integrity.attempt_to_download(PACKAGE_URL, out_file) out_file1 = os.path.join(tmpd, os.path.basename(XATTR_PKT_URL)) pkg_integrity.attempt_to_download(XATTR_PKT_URL, out_file1) result = pkg_integrity.from_url(PACKAGE_URL, tmpd) self.assertTrue(result)
def test_from_url(self): with tempfile.TemporaryDirectory() as tmpd: out_file = os.path.join(tmpd, os.path.basename(GEM_PKT)) pkg_integrity.attempt_to_download(GEM_PKT, out_file) result = pkg_integrity.from_url(GEM_PKT, tmpd) self.assertTrue(result)