Skip to content
Permalink
Browse files

Add more tests

  • Loading branch information
pblottiere committed Jul 11, 2017
1 parent 75811ef commit 92bad9254ee749cb2467f6c10c3ffd185546bd14
Showing with 24 additions and 0 deletions.
  1. +24 −0 tests/src/python/test_qgsproject.py
@@ -702,9 +702,29 @@ def test_zip_new_project(self):

def test_zip_invalid_path(self):
project = QgsProject()
self.assertFalse(project.zip())
self.assertFalse(project.zip("/fake/test.zip"))
self.assertFalse(project.zip(""))

def test_zip_filename(self):
tmpFile = QTemporaryFile()
tmpFile.open()
tmpFile.close()
os.remove(tmpFile.fileName())

project = QgsProject()
self.assertFalse(project.zip())

project.setZipFileName(tmpFile.fileName())
self.assertTrue(project.zip())
self.assertTrue(os.path.isfile(tmpFile.fileName()))

def test_unzip_invalid_path(self):
project = QgsProject()
self.assertFalse(project.unzip())
self.assertFalse(project.unzip(""))
self.assertFalse(project.unzip("/fake/test.zip"))

def test_zip_unzip(self):
tmpFile = QTemporaryFile()
tmpFile.open()
@@ -719,7 +739,11 @@ def test_zip_unzip(self):
self.assertTrue(project.zip(tmpFile.fileName()))

project2 = QgsProject()
self.assertFalse(project2.unzipped())
self.assertTrue(project2.zipFileName() == "")
self.assertTrue(project2.unzip(tmpFile.fileName()))
self.assertTrue(project2.unzipped())
self.assertTrue(project2.zipFileName() == tmpFile.fileName())
layers = project2.mapLayers()

self.assertEqual(len(layers.keys()), 2)

0 comments on commit 92bad92

Please sign in to comment.
You can’t perform that action at this time.