def test_upload_bad_file_with_verbosity(self): self.args.action = 'upload' self.args.verbose = True self.args.file = 'notreal' with self.assertRaises(SystemExit) as ex: clitool.upload(self.args) self.assertEqual(ex.exception.code, 1)
def test_upload_download(self): self.args.action = 'upload' clitool.upload(self.args) self.args.action = 'download' clitool.download(self.args) orig_sha256 = ("bc839c0f9195028d375d652e72a5d08d" "293eefd22868493185f084bc4aa61d00") sha256 = hashlib.sha256() with open(self.downloadfile, 'rb') as f: sha256.update(f.read()) new_sha256 = sha256.hexdigest() self.assertEqual(orig_sha256, new_sha256)