def test_unzip_file_not_exist(self): outDir = QTemporaryDir() zip = os.path.join(self.zipDir, 'fake.zip') rc, files = QgsZipUtils.unzip(zip, outDir.path()) self.assertFalse(rc)
def test_unzip_ok(self): outDir = QTemporaryDir() zip = os.path.join(self.zipDir, 'testzip.zip') rc, files = QgsZipUtils.unzip(zip, outDir.path()) self.assertTrue(rc) self.assertEqual(len(files), 11)
def test_zip_unzip_ok(self): zip = tmpPath() f0 = os.path.join(unitTestDataPath(), 'multipoint.shp') f1 = os.path.join(unitTestDataPath(), 'lines.shp') f2 = os.path.join(unitTestDataPath(), 'joins.qgs') rc = QgsZipUtils.zip(zip, [f0, f1, f2]) self.assertTrue(rc) outDir = QTemporaryDir() rc, files = QgsZipUtils.unzip(zip, outDir.path()) self.assertTrue(rc) self.assertEqual(len(files), 3)
def test_unzip_dir_not_exist(self): zip = os.path.join(self.zipDir, 'testzip.zip') rc, files = QgsZipUtils.unzip(zip, '/tmp/fake') self.assertFalse(rc)
def test_unzip_file_empty(self): outDir = QTemporaryDir() rc, files = QgsZipUtils.unzip("", outDir.path()) self.assertFalse(rc)
def test_unzip_dir_empty(self): zip = os.path.join(self.zipDir, 'testzip.zip') rc, files = QgsZipUtils.unzip(zip, '') self.assertFalse(rc)