Beispiel #1
0
    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)
Beispiel #2
0
    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)
Beispiel #3
0
    def test_download_no_dest(self):
        self.args.action = 'download'
        self.args.dest = None
        filepath = clitool.download(self.args)
        self.assertTrue(filepath)
        self.assertTrue(os.path.isfile(filepath))

        orig_sha256 = ("bc839c0f9195028d375d652e72a5d08d"
                       "293eefd22868493185f084bc4aa61d00")
        sha256 = hashlib.sha256()
        with open(filepath, 'rb') as f:
            sha256.update(f.read())
        new_sha256 = sha256.hexdigest()
        self.assertEqual(orig_sha256, new_sha256)
Beispiel #4
0
    def test_download_no_dest(self):
        self.args.action = 'download'
        self.args.dest = None
        filepath = clitool.download(self.args)
        self.assertTrue(filepath)
        self.assertTrue(os.path.isfile(filepath))

        orig_sha256 = ("bc839c0f9195028d375d652e72a5d08d"
                       "293eefd22868493185f084bc4aa61d00")
        sha256 = hashlib.sha256()
        with open(filepath, 'rb') as f:
            sha256.update(f.read())
        new_sha256 = sha256.hexdigest()
        self.assertEqual(orig_sha256, new_sha256)
        os.remove(filepath)
Beispiel #5
0
 def test_download_bad_dest(self):
     self.args.action = 'download'
     self.args.dest = 'tests'
     with self.assertRaises(FileError):
         clitool.download(self.args)
Beispiel #6
0
 def test_download_bad_dest(self):
     self.args.action = 'download'
     self.args.dest = 'tests'
     with self.assertRaises(FileError):
         filepath = clitool.download(self.args)