Ejemplo n.º 1
0
 def test_non_matchingsig(self):
     with tempfile.TemporaryDirectory() as tmpd:
         out_file = os.path.join(tmpd, os.path.basename(ALEMBIC_PKT_URL))
         f = open(out_file, 'wb')
         f.write(b'made up date that will fail check')
         f.close()
         with self.assertRaises(SystemExit) as a:
             from_url(ALEMBIC_PKT_URL, tmpd)
         self.assertEqual(a.exception.code, 1)
Ejemplo n.º 2
0
 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:
             from_url(GEM_PKT, tmpd)
         self.assertEqual(a.exception.code, 1)
Ejemplo n.º 3
0
 def test_from_url(self):
     with tempfile.TemporaryDirectory() as tmpd:
         out_file = os.path.join(tmpd, os.path.basename(ALEMBIC_PKT_URL))
         attempt_to_download(ALEMBIC_PKT_URL, out_file)
         out_file1 = os.path.join(tmpd, os.path.basename(XATTR_PKT_URL))
         attempt_to_download(XATTR_PKT_URL, out_file1)
         result = from_url(ALEMBIC_PKT_URL, tmpd)
         self.assertTrue(result)
         result = from_url(XATTR_PKT_URL, tmpd)
         self.assertTrue(result is None)
Ejemplo n.º 4
0
 def test_from_url(self):
     with tempfile.TemporaryDirectory() as tmpd:
         out_file = os.path.join(tmpd, os.path.basename(GEM_PKT))
         attempt_to_download(GEM_PKT, out_file)
         result = from_url(GEM_PKT, tmpd)
         self.assertTrue(result)
Ejemplo n.º 5
0
 def test_result_on_nosign_package(self):
     with tempfile.TemporaryDirectory() as tmpd:
         out_file = os.path.join(tmpd, os.path.basename(NO_SIGN_PKT_URL))
         attempt_to_download(NO_SIGN_PKT_URL, out_file)
         result = from_url(NO_SIGN_PKT_URL, tmpd)
         self.assertTrue(result is None)