Example #1
0
 def testFeature(self):
     repo = _createSimpleTestRepo()
     expected = {u'geometry': u'POINT (5 5)', u'n': 2}
     diff = repo.diff(repo.log()[2].commitid, repo.log()[1].commitid)
     path = diff[0].path
     feature = repo.feature(path, repo.HEAD)
     self.assertEqual(expected, feature)
Example #2
0
 def testConflictsWithDeleteAndModify(self):
     repo = _createSimpleTestRepo(True)
     log = repo.log()
     origCommit = log[0].commitid
     filename = tempFilename("gpkg")
     repo.checkoutlayer(filename, "points", ref = log[0].commitid)
     layer = loadLayerNoCrsDialog(filename, "points", "ogr")
     idx = layer.dataProvider().fieldNameIndex("n")
     filename2 = tempFilename("gpkg")
     repo.checkoutlayer(filename2, "points", ref = log[0].commitid)
     layer2 = loadLayerNoCrsDialog(filename2, "points", "ogr")
     features = list(layer.getFeatures())
     with edit(layer):
         layer.changeAttributeValue(features[0].id(), idx, 1000)
         layer.changeAttributeValue(features[1].id(), idx, 2000)
     _, _, conflicts, _ = repo.importgeopkg(layer, "master", "message", "me", "*****@*****.**", True)
     self.assertEqual(0, len(conflicts))
     features2 = list(layer2.getFeatures())
     with edit(layer2):
         layer2.deleteFeatures([features2[0].id()])
         layer2.deleteFeatures([features2[1].id()])
     _, _, conflicts, _ = repo.importgeopkg(layer2, "master", "another message", "me", "*****@*****.**", True)
     self.assertEqual(2, len(conflicts))
     diff = repo.diff(repo.log()[0].commitid, repo.log()[1].commitid)
     self.assertEqual(diff[0].path, conflicts[0].path)
     self.assertEqual(origCommit, conflicts[0].originCommit)
     self.assertEqual(diff[1].path, conflicts[1].path)
Example #3
0
 def testLayerCommitId(self):
     repo = _createSimpleTestRepo(True)
     log = repo.log()
     filename = tempFilename("gpkg")
     repo.checkoutlayer(filename, "points", ref = log[1].commitid)
     layer = loadLayerNoCrsDialog(filename, "points", "ogr")
     self.assertTrue(log[1].commitid, getCommitId(layer))
Example #4
0
 def testRemoveTags(self):
     repo = _createSimpleTestRepo(True)
     tags = repo.tags()
     self.assertEquals(1, len(tags))
     repo.deletetag(list(tags.keys())[0])
     tags = repo.tags()
     self.assertEquals(0, len(tags))
Example #5
0
 def testPullWithConflicts(self):
     repo = _createSimpleTestRepo(True)
     repo2 = _createEmptyTestRepo(True)
     repo.addremote("myremote", repo2.url)
     repo2.addremote("myremote", repo.url)
     repo.push("myremote", "master")
     filename = tempFilename("gpkg")
     repo.checkoutlayer(filename, "points", ref = repo.HEAD)
     layer = loadLayerNoCrsDialog(filename, "points", "ogr")
     idx = layer.dataProvider().fieldNameIndex("n")
     features = list(layer.getFeatures())
     with edit(layer):
         layer.changeAttributeValue(features[0].id(), idx, 1000)
         layer.changeAttributeValue(features[1].id(), idx, 2000)
     _, _, conflicts, _ = repo.importgeopkg(layer, "master", "message", "me", "*****@*****.**", True)
     filename2 = tempFilename("gpkg")
     repo2.checkoutlayer(filename2, "points", ref = repo.HEAD)
     layer2 = loadLayerNoCrsDialog(filename2, "points", "ogr")
     features = list(layer2.getFeatures())
     with edit(layer2):
         layer2.changeAttributeValue(features[0].id(), idx, 1001)
         layer2.changeAttributeValue(features[1].id(), idx, 2001)
     _, _, conflicts, _ = repo2.importgeopkg(layer2, "master", "message2", "me", "*****@*****.**", True)
     conflicts = repo2.pull("myremote", "master")
     self.assertEqual(2, len(conflicts))
Example #6
0
 def _createConflict(self):
     repo = _createSimpleTestRepo(True)
     log = repo.log()
     filename = tempFilename("gpkg")
     repo.checkoutlayer(filename, "points", ref = log[0].commitid)
     layer = loadLayerNoCrsDialog(filename, "points", "ogr")
     idx = layer.dataProvider().fieldNameIndex("n")
     filename2 = tempFilename("gpkg")
     repo.checkoutlayer(filename2, "points", ref = log[0].commitid)
     layer2 = loadLayerNoCrsDialog(filename2, "points", "ogr")
     features = list(layer.getFeatures())
     with edit(layer):
         layer.changeAttributeValue(features[0].id(), idx, 1000)
         layer.changeAttributeValue(features[1].id(), idx, 2000)
     _, _, conflicts, _ = repo.importgeopkg(layer, "master", "message", "me", "*****@*****.**", True)
     self.assertEqual(0, len(conflicts))
     features2 = list(layer2.getFeatures())
     with edit(layer2):
         layer2.changeAttributeValue(features2[0].id(), idx, 1001)
         layer2.changeAttributeValue(features2[1].id(), idx, 2001)
     layer3 = loadLayerNoCrsDialog(filename2, "points", "ogr")
     feature = next(layer3.getFeatures(QgsFeatureRequest(features2[0].id())))
     self.assertEquals(1001, feature["n"])
     _, _, conflicts, _ = repo.importgeopkg(layer2, "master", "another message", "me", "*****@*****.**", True)
     self.assertEqual(2, len(conflicts))
     self.assertEqual(conflicts[0].localFeature['n'], 1001)
     return repo, conflicts
Example #7
0
def _createNothingToPushScenario():
    global _remoteRepo
    _remoteRepo = _createEmptyTestRepo(True)
    global _localRepo
    _localRepo = _createSimpleTestRepo(True)
    _localRepo.addremote("myremote", _remoteRepo.url)
    _remoteRepo.addremote("myremote", _localRepo.url)
    _localRepo.push("myremote", "master")
Example #8
0
 def testLogWithPath(self):
     repo = _createSimpleTestRepo()
     diff = repo.diff(repo.log()[1].commitid, repo.log()[0].commitid)
     path = diff[0].path
     log = repo.log(path = path)
     self.assertEqual(2, len(log))
     self.assertEqual("third", log[0].message)
     self.assertEqual("second", log[1].message)
def _createNothingToPushScenario():
    global _remoteRepo
    _remoteRepo = _createEmptyTestRepo(True)
    global _localRepo
    _localRepo = _createSimpleTestRepo(True)
    _localRepo.addremote("myremote", _remoteRepo.url)
    _remoteRepo.addremote("myremote", _localRepo.url)
    _localRepo.push("myremote", "master")
Example #10
0
 def testCreateBranch(self):
     repo = _createSimpleTestRepo(True)
     self.assertEquals(["master", "mybranch"], repo.branches())
     repo.createbranch(repo.HEAD, "anotherbranch")
     self.assertEquals({"master", "mybranch", "anotherbranch"},
                       set(repo.branches()))
     self.assertEqual(repo.revparse(repo.HEAD),
                      repo.revparse("anotherbranch"))
Example #11
0
 def testRemotes(self):
     repo = _createSimpleTestRepo(True)
     remotes = repo.remotes()
     self.assertEqual({}, remotes)
     repo.addremote("myremote", "http://myurl.com")
     remotes = repo.remotes()
     self.assertEqual({"myremote": "http://myurl.com"}, remotes)
     repo.removeremote("myremote")
     remotes = repo.remotes()
     self.assertEqual({}, remotes)
Example #12
0
 def testCreateTag(self):
     repo = _createSimpleTestRepo(True)
     repo.createtag(repo.HEAD, "anothertag")
     tags = repo.tags()
     log = repo.log()
     self.assertEqual(2, len(tags))
     self.assertTrue("mytag" in tags)
     self.assertEqual(tags["mytag"], log[0].commitid)
     self.assertTrue("anothertag" in tags)
     self.assertEqual(tags["anothertag"], log[0].commitid)
Example #13
0
 def testDownloadNonHead(self):
     repo = _createSimpleTestRepo()
     log = repo.log()
     self.assertEqual(3, len(log))
     commitid = log[-1].commitid
     filename = tempFilename("gpkg")
     repo.checkoutlayer(filename, "points", ref = commitid)
     layer = loadLayerNoCrsDialog(filename, "points", "ogr")
     self.assertTrue(layer.isValid())
     features = list(layer.getFeatures())
     self.assertEqual(1, len(features))
Example #14
0
 def testPush(self):
     repo = _createSimpleTestRepo(True)
     repo2 = _createEmptyTestRepo(True)
     repo.addremote("myremote", repo2.url)
     repo2.addremote("myremote", repo.url)
     repo.push("myremote", "master")
     log = repo.log()
     log2 = repo2.log()
     self.assertEqual(log[0].message, log2[0].message)
     self.assertEqual(len(log), len(log2))
     self.assertRaises(NothingToPushException, lambda: repo2.push("myremote", "master"))
Example #15
0
 def testDiffWithPath(self):
     repo =_createSimpleTestRepo()
     log = repo.log()
     self.assertEqual(3, len(log))
     expected = [{u'changetype': u'ADDED', u'attributename': u'n', u'newvalue': 2},
                 {u'geometry': True, u'crs': u'EPSG:4326', u'changetype': u'ADDED',
                  u'attributename': u'geometry', u'newvalue': u'POINT (5 5)'}]
     diff = repo.diff(repo.log()[2].commitid, repo.log()[1].commitid)
     path = diff[0].path
     diff = repo.diff(log[-1].commitid, log[0].commitid, path)
     self.assertTrue(1, len(diff))
     self.assertTrue(self._compareLists(expected, diff[0].featurediff()))
Example #16
0
 def testImportWithNullValue(self):
     repo = _createSimpleTestRepo(True)
     filename = tempFilename("gpkg")
     repo.checkoutlayer(filename, "points")
     layer = loadLayerNoCrsDialog(filename, "points", "ogr")
     self.assertTrue(layer.isValid())
     features = list(layer.getFeatures())
     self.assertEqual(2, len(features))
     idx = layer.dataProvider().fieldNameIndex("n")
     features = list(layer.getFeatures())
     with edit(layer):
         layer.changeGeometry(features[0].id(), QgsGeometry.fromPoint(QgsPoint(123, 456)))
         layer.changeAttributeValue(features[0].id(), idx, None)
     repo.importgeopkg(layer, "master", "message", "me", "*****@*****.**", True)
     log = repo.log()
     self.assertEqual("message", log[0].message)
def _createPullScenario():
    global _remoteRepo
    _remoteRepo = _createEmptyTestRepo(True)
    global _localRepo
    _localRepo = _createSimpleTestRepo(True)
    _localRepo.addremote("myremote", _remoteRepo.url)
    _remoteRepo.addremote("myremote", _localRepo.url)
    _localRepo.push("myremote", "master")
    filename = tempFilename("gpkg")
    _remoteRepo.checkoutlayer(filename, "points")
    layer = loadLayerNoCrsDialog(filename, "points", "ogr")
    idx = layer.dataProvider().fieldNameIndex("n")
    features  = list(layer.getFeatures())
    with edit(layer):
        layer.changeAttributeValue(features[0].id(), idx, 1001)
    _remoteRepo.importgeopkg(layer, "master", "message2", "me", "*****@*****.**", True)
 def testChangeVersion(self):
     repo = _createSimpleTestRepo()
     log = repo.log()
     self.assertEqual(3, len(log))
     commitid = log[-1].commitid
     filename = tempFilename("gpkg")
     repo.checkoutlayer(filename, "points", ref = commitid)
     layer = loadLayerNoCrsDialog(filename, "points", "ogr")
     self.assertTrue(layer.isValid())
     features = list(layer.getFeatures())
     self.assertEqual(1, len(features))
     applyLayerChanges(repo, layer, commitid, repo.HEAD)
     layer.reload()
     self.assertTrue(layer.isValid())
     features = list(layer.getFeatures())
     self.assertEqual(2, len(features))
     self.assertEqual(getCommitId(layer), log[0].commitid)
Example #19
0
 def testChangeVersion(self):
     repo = _createSimpleTestRepo()
     log = repo.log()
     self.assertEqual(3, len(log))
     commitid = log[-1].commitid
     filename = tempFilename("gpkg")
     repo.checkoutlayer(filename, "points", ref = commitid)
     layer = loadLayerNoCrsDialog(filename, "points", "ogr")
     self.assertTrue(layer.isValid())
     features = list(layer.getFeatures())
     self.assertEqual(1, len(features))
     applyLayerChanges(repo, layer, commitid, repo.HEAD)
     layer.reload()
     self.assertTrue(layer.isValid())
     features = list(layer.getFeatures())
     self.assertEqual(2, len(features))
     self.assertEqual(getCommitId(layer), log[0].commitid)
Example #20
0
def _createPullScenario():
    global _remoteRepo
    _remoteRepo = _createEmptyTestRepo(True)
    global _localRepo
    _localRepo = _createSimpleTestRepo(True)
    _localRepo.addremote("myremote", _remoteRepo.url)
    _remoteRepo.addremote("myremote", _localRepo.url)
    _localRepo.push("myremote", "master")
    filename = tempFilename("gpkg")
    _remoteRepo.checkoutlayer(filename, "points")
    layer = loadLayerNoCrsDialog(filename, "points", "ogr")
    idx = layer.dataProvider().fieldNameIndex("n")
    features = list(layer.getFeatures())
    with edit(layer):
        layer.changeAttributeValue(features[0].id(), idx, 1001)
    _remoteRepo.importgeopkg(layer, "master", "message2", "me",
                             "*****@*****.**", True)
Example #21
0
 def testImportInterchangeFormat(self):
     repo = _createSimpleTestRepo(True)
     filename = tempFilename("gpkg")
     repo.checkoutlayer(filename, "points")
     layer = loadLayerNoCrsDialog(filename, "points", "ogr")
     self.assertTrue(layer.isValid())
     features = list(layer.getFeatures())
     self.assertEqual(2, len(features))
     with edit(layer):
         layer.deleteFeatures([features[0].id()])
     features = list(layer.getFeatures())
     self.assertEqual(1, len(features))
     repo.importgeopkg(layer, "master", "message", "me", "*****@*****.**", True)
     log = repo.log()
     self.assertEqual("message", log[0].message)
     self.assertEqual(["points"], repo.trees())
     filename2 = tempFilename("gpkg")
     repo.checkoutlayer(filename2, "points")
     layer2 = loadLayerNoCrsDialog(filename, "points2", "ogr")
     self.assertTrue(layer2.isValid())
     features2 = list(layer2.getFeatures())
     self.assertEqual(1, len(features2))
Example #22
0
 def testRevParse(self):
     repo = _createSimpleTestRepo()
     head = repo.log()[0].commitid
     self.assertEqual(head, repo.revparse(repo.HEAD))
Example #23
0
 def testDownload(self):
     repo = _createSimpleTestRepo()
     filename = tempFilename("gpkg")
     repo.checkoutlayer(filename, "points")
     layer = loadLayerNoCrsDialog(filename, "points", "ogr")
     self.assertTrue(layer.isValid())
Example #24
0
 def testBlame(self):
     repo = _createSimpleTestRepo()
def functionalTests():
    try:
        from qgistester.test import Test
        class GeoGigTest(Test):
            def __init__(self, name, category = "General"):
                Test.__init__(self, name, category)
                self.addStep("Preparing test", backupConfiguration)
                self.setCleanup(restoreConfiguration)

    except:
        return []

    tests = []

    test = GeoGigTest("Connect to endpoint")
    test.addStep("Open navigator", lambda:  _openNavigator(True))
    test.addStep("Add a new geogig server at the repositories server url")
    test.addStep("Verify the endpoint item has been correctly added (might contain child repos or not)")
    tests.append(test)

    test = GeoGigTest("Connect to wrong endpoint")
    test.addStep("Open navigator", lambda:  _openNavigator(True))
    test.addStep("Add a new geogig server at 'http://wrong.url'")
    test.addStep("Verify a warning indicating that the url is wrong is shown. Verify endpoint item is added to tree and grayed out.")
    tests.append(test)

    test = GeoGigTest("Add layer without repo")
    test.addStep("Open test data", lambda: openTestProject("points"))
    test.addStep("Open navigator", lambda:  _openNavigator(True))
    test.addStep("Right click on the layer and try to add it to a repository.\n"
                 "Verify that it shows a warning because there are no repositories defined.")
    tests.append(test)

    test = GeoGigTest("Add layer to repository")
    test.addStep("Open test data", lambda: openTestProject("points"))
    test.addStep("Create repository", lambda: _createEmptyTestRepo(True))
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Add layer 'points' to the 'empty' repository using layer's context menu")
    test.addStep("Check layer has been added to repo", _checkLayerInRepo)
    tests.append(test)

    test = GeoGigTest("Edit and delete endpoint")
    test.addStep("Create repository", lambda: _createEmptyTestRepo(True))
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Change endpoint name by pressing 'Edit' button. Verify that name changed and no error is thrown")
    test.addStep("Remove endpoint by pressing 'Delete' button. Verify that endpoint removed and buttons desctivated")
    tests.append(test)

    test = GeoGigTest("Add geopackage with multiple layers to repository")
    test.addStep("Open test data", lambda: openTestProject("multilayer"))
    test.addStep("Create repository", lambda: _createEmptyTestRepo(True))
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Add layer 'points' to the 'empty' repository using layer's context menu")
    test.addStep("Check that warning message shown and no error is thrown")
    tests.append(test)

    test = GeoGigTest("Check repository log")
    test.addStep("Create repository", lambda: _createSimpleTestRepo())
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Check log is correctly displayed in the history tab of the GeoGig navigator")
    tests.append(test)

    test = GeoGigTest("Open repository layers in QGIS", "Export layers tests")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("New project", iface.newProject)
    test.addStep("Add layer from the 'simple' repository into QGIS. To do it, right-click in the layer item of the repository tree and use the corresponding context menu entry.")
    test.addStep("Check layer has been added to project", _checkLayerInProject)
    tests.append(test)

    test = GeoGigTest("Open repository layers in QGIS from tree", "Export layers tests")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("New project", iface.newProject)
    test.addStep("Add layer from the 'simple' repository into QGIS. To do it, right-click in the layer item of the repository tree and use the corresponding context menu entry.")
    test.addStep("Check layer has been added to project", _checkLayerInProject)
    tests.append(test)

    test = GeoGigTest("Open already exported layers in QGIS from tree", "Export layers tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export repo layer", _exportAndChangeToFirstVersion)
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Add layer from the 'simple' repository into QGIS. To do it, right-click in the layer item of the repository tree and use the corresponding context menu entry. "
                 "Verify that is asks you for confirmation. Select 'Use branch version'", isVerifyStep = True)
    test.addStep("Check context menu info", lambda: _checkContextMenuInfo("third"))
    tests.append(test)

    test = GeoGigTest("Open already exported layers in QGIS when there are local changes", "Export layers tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export repo layer", _exportAndEditLayer)
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Add layer from the 'simple' repository into QGIS. To do it, right-click in the layer item of the repository tree and use the corresponding context menu entry."
                 "Verify it show a message in the message bar saying that the layer was already loaded", isVerifyStep = True)
    tests.append(test)

    test = GeoGigTest("Open already exported layers in QGIS to an older version, with local changes", "Export layers tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export repo layer", _exportChangetoFirstVersionAndEditLayer)
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Add layer from the 'simple' repository into QGIS. To do it, right-click in the layer item of the repository tree and use the corresponding context menu entry.  "
                 "Verify that is asks you for confirmation. Select 'Use branch version'. Check it is not permitted due to local changes in the layer",
                 isVerifyStep = True)
    tests.append(test)

    test = GeoGigTest("Open layers in QGIS from history tree", "Export layers tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Add layer from the 'simple' repository into QGIS. To do it, right-click in the last commit of the 'master' branch in the history tree and use the corresponding context menu entry."
                 "Check a layer is correctly added",
                 isVerifyStep = True)
    test.addStep("Update layer from the 'simple' repository into QGIS. To do it, right-click in the last commit of the 'mybranch' branch in the history tree and use the corresponding context menu entry."
                 "Check that a warning message is shown. Select to overwrite the layer and verify it is updated",
                 isVerifyStep = True)
    tests.append(test)

    test = GeoGigTest("Change layer version", "Export layers tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export repo layer", _exportAndChangeToFirstVersion)
    test.addStep("Change version to 'third' using the 'Change version' menu entry in the layer context menu")
    test.addStep("Check layer has been added to project", _checkLayerInProject)
    test.addStep("Check context menu info", lambda: _checkContextMenuInfo("third"))
    tests.append(test)

    test = GeoGigTest("Change layer version when there are local changes", "Export layers tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export repo layer", _exportAndEditLayer)
    test.addStep("Try to change version using the 'Change version' menu entry in the layer context menu."
                 "Check it is not permitted due to local changes in the layer", isVerifyStep = True)
    tests.append(test)

    test = Test("Sync with only local changes", "Synchronization tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Export and edit repo layer", _exportAndEditLayer)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch'. Sync with master branch'")
    test.addStep("Check in repo history that a new version has been created")
    tests.append(test)

    test = Test("Sync to non-master branch", "Synchronization tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Export and edit repo layer", _exportAndEditLayer)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch'. Select 'mybranch' in the branch box and sync'")
    test.addStep("Check in repo history that the 'mybranch' branch has been updated with the changes")
    tests.append(test)

    test = Test("Sync with only upstream changes", "Synchronization tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Export repo layer", _exportAndChangeToFirstVersion)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch'. Sync with master branch'")
    test.addStep("Check context menu info", lambda: _checkContextMenuInfo("third"))
    test.addStep("Check that layer has been modified")
    tests.append(test)

    test = Test("Sync with no changes at all", "Synchronization tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export repo layer", _exportLayer)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch'. Sync with master branch'")
    test.addStep("Check context menu info", lambda: _checkContextMenuInfo("third"))
    test.addStep("Check that no changes are made in the layer or the history")
    tests.append(test)

    test = Test("Merge without conflicts", "Merge tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Create merge conflict", _createMergeScenario)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Merge 'mybranch' branch into 'master' branch")
    test.addStep("Check that the merge was correctly completed")
    tests.append(test)

    test = Test("Merge with conflicts", "Merge tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Create merge conflict", _createMergeConflict)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Merge 'mybranch' branch into 'master' branch. Solve conflict")
    test.addStep("Check that the merge was correctly completed")
    tests.append(test)

    test = Test("Merge with conflicts in several layers", "Merge tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createMultilayerTestRepo(True))
    test.addStep("Create merge conflict", _createMergeConflictInSeveralLayers)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Merge 'mybranch' branch into 'master' branch. Solve conflict")
    test.addStep("Check that the merge was correctly completed")
    tests.append(test)

    test = Test("Sync with conflicts", "Synchronization tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export and edit repo layer", _exportAndCreateConflict)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch'. Sync with master branch. Solve conflict'")
    test.addStep("Check that new version has been created in the repo history")
    tests.append(test)

    test = Test("Sync with conflict, with remove and modify", "Synchronization tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export and edit repo layer", _exportAndCreateConflictWithRemoveAndModify)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch'. Sync with master branch. Solve conflict'")
    test.addStep("Check that new version has been created in the repo history")
    tests.append(test)

    test = Test("Sync with conflicts and null values", "Synchronization tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export and edit repo layer", _exportAndCreateConflictWithNulls)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch'. Sync with master branch. Solve conflict with a new feature'")
    test.addStep("Check that new version has been created in the repo history")
    tests.append(test)

    test = Test("Sync with conflicts, without resolving them", "Synchronization tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export and edit repo layer", _exportAndCreateConflict)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch'. Sync with master branch. Exit conflict dialog without solving'")
    test.addStep("Check that no new version has been created in the repo history, and the layer hasn't been modified")
    tests.append(test)

    test = Test("Sync with both local and upstream changes, without conflict", "Synchronization tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Export and edit repo layer", _exportAndAddFeatureToLayer)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch. Sync with master branch'")
    test.addStep("Check that layer has been modified and a new version has been created in the repo history")
    tests.append(test)

    test = Test("Sync with layer only in one branch", "Synchronization tests")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Export repo layer", _exportLayer)
    test.addStep("Delete layer from branch", _deleteLayerFromBranch)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch. Verify that only 'master'branch is available")
    tests.append(test)

    test = Test("Pull without conflicts")
    test.addStep("New project", iface.newProject)
    test.addStep("Prepare test", _createPullScenario)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Select the repository in the repository explorer. Pull from 'myremote' into'master' branch. Verify the pull operation id performed correctly.")
    tests.append(test)

    test = Test("Push")
    test.addStep("New project", iface.newProject)
    test.addStep("Prepare test", _createPushScenario)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Select the repository in the repository explorer. Push to 'myremote' repo . Verify the push operation id performed correctly.")
    tests.append(test)

    test = Test("Pull with conflicts")
    test.addStep("New project", iface.newProject)
    test.addStep("Prepare test", _createConflictedPullScenario)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Select the repository in the repository explorer. Pull from 'myremote' into'master' branch. It will warn you of existing conflict. Solve conflicts and verify it finishes the pull operation correctly.")
    tests.append(test)

    test = Test("Nothing to push")
    test.addStep("New project", iface.newProject)
    test.addStep("Prepare test", _createNothingToPushScenario)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Select the repository in the repository explorer. Push to 'myremote' repo . Verify the push operation is not performed and the corresponding message is displayed.")
    tests.append(test)

    test = Test("TEST SCENARIO: Two cloned repos")
    test.addStep("New project", iface.newProject)
    test.addStep("Prepare test", _createNothingToPushScenario)
    test.addStep("Open navigator", lambda: _openNavigator(repos = [_remoteRepo, _localRepo]))
    test.addStep("TEST ON THE LOCAL AND REMOTE REPOS")
    tests.append(test)

    test = Test("Cannot push")
    test.addStep("New project", iface.newProject)
    test.addStep("Prepare test", _createCannotPushScenario)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Select the repository in the repository explorer. Push to 'myremote' repo . Verify the push operation is performed correctly.")
    tests.append(test)

    test = Test("Check diff viewer")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo())
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Click on latest commit and select 'View changes'. Check that diff viewer works correctly", isVerifyStep = True)
    test.addStep("Select two commits, right-click and select 'View changes'. Check that diff viewer works correctly", isVerifyStep = True)
    test.addStep("Select the two branch items in the history tree, right-click and select 'View changes'. Check that diff viewer works correctly", isVerifyStep = True)
    tests.append(test)

    test = Test("Check local diff viewer")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export and edit repo layer", _exportAndEditLayer)
    test.addStep("Right click on 'points' layer and select 'GeoGig/view local changes'. Check that diff viewer works correctly")
    tests.append(test)

    test = Test("Check export diff layer")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Add commit", _addNewCommit)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Click on latest commit in master branch and select 'Export diff as layer'. Check that layer is exported correctly")
    tests.append(test)

    test = GeoGigTest("Add layer to repository from context menu")
    test.addStep("Open test data", lambda: openTestProject("points"))
    test.addStep("Create repository", lambda: _createEmptyTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Add layer using context menu")
    test.addStep("Check layer has been added to repo", _checkLayerInRepo)
    test.addStep("Check layer context menus", _checkLayerHasTrackedContextMenus)
    tests.append(test)

    test = GeoGigTest("Show version characteristics")
    test.addStep("Create repository", lambda: _createSimpleTestRepo())
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Right click on repo's last commit and select 'Show detailed description'\nVerify description is correctly shown")
    tests.append(test)

    test = GeoGigTest("Create new branch", "Branch and tag tests")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Create new branch at master branch's last commit and verify it is added to history tree")
    tests.append(test)

    test = GeoGigTest("Delete branch", "Branch and tag tests")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Verify that 'master' branch cannot be deleted from history tree", isVerifyStep = True)
    test.addStep("Delete 'mybranch' using repo history panel and verify the history tree is updated")
    tests.append(test)


    test = GeoGigTest("Create new branch from repo tree", "Branch and tag tests")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Create new branch at master branch using the repos tree context menu. Verify it is added to history tree")
    tests.append(test)

    test = GeoGigTest("Delete branch", "Branch and tag tests")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Verify that 'master' branch cannot be deleted from repos tree", isVerifyStep = True)
    test.addStep("Delete 'mybranch' using repos tree context menu panel and verify that also the history tree is updated")
    tests.append(test)

    test = GeoGigTest("Delete branch in repositories tree", "Branch and tag tests")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Verify that 'master' branch cannot be deleted from repositories tree", isVerifyStep = True)
    test.addStep("Delete 'mybranch' from the versions tree and verify the repositories tree is updated")
    tests.append(test)

    test = GeoGigTest("Delete layer in repositories tree, in 'master' branch")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Delete 'points' layer in 'master' branch in repositories tree, and verify the repositories tree is updated correctly")
    tests.append(test)

    test = GeoGigTest("Delete layer in tree, in non-master branch")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Delete 'points' layer in 'mybranch' branch in repositories tree, and verify the versions tree is updated correctly")
    tests.append(test)

    test = GeoGigTest("Delete layer in tree, in all branches")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export repo layer", _exportLayer)
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Delete 'points' layer in 'mybranch' branch in repositories tree, and verify the versions tree is updated correctly."
                 "Verify that the context menu of the layer still shows the tracked layer menus")
    test.addStep("Delete 'points' layer in 'master' branch in repositories tree, and verify the versions tree is updated correctly."
                 "Verify that the context menu of the layer shows the layer as untracked")
    tests.append(test)

    test = GeoGigTest("Revert commit that adds a layer")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export repo layer", _exportLayer)
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Revert commit...'. Select commit that adds layer and press OK button.")
    test.addStep("Check that warning message is shown and no error is thrown.")
    tests.append(test)

    test = GeoGigTest("Create new tag", "Branch and tag tests")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Create new tag at current branch's last commit and verify it is added to history tree")
    tests.append(test)

    test = GeoGigTest("Delete tag", "Branch and tag tests")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Delete 'mytag' tag and verify the versions tree is updated")
    tests.append(test)

    test = Test("Check map tools viewer")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export layer", _exportLayer)
    test.addStep("Select the 'GeoGig/Info Tool' menu")
    test.addStep("Select layer", _selectLayer)
    test.addStep("Click on a feature and select 'View authorship'. Verify it shows authorship correctly", isVerifyStep = True)
    test.addStep("Click on a feature and select 'View versions'. Verify it shows feature versions correctly")
    tests.append(test)

    return tests
Example #26
0
 def testLog(self):
     repo = _createSimpleTestRepo()
     log = repo.log()
     self.assertEqual(3, len(log))
     self.assertEqual("third", log[0].message)
Example #27
0
 def testCreateRepoWithNameThatAlreadyExists(self):
     repo_name =  "test-repo-same-name-%s" %  str(time.time())
     repo = _createSimpleTestRepo(group="test",name=repo_name)
     self.assertRaises(GeoGigException, lambda: createRepoAtUrl(conf['REPOS_SERVER_URL'], "test", repo_name))
Example #28
0
def functionalTests():
    try:
        from qgistester.test import Test
        class GeoGigTest(Test):
            def __init__(self, name):
                Test.__init__(self, name)
                self.addStep("Preparing test", backupConfiguration)
                self.setCleanup(restoreConfiguration)

    except:
        return []

    tests = []


    test = GeoGigTest("Connect to endpoint")
    test.addStep("Open navigator", lambda:  _openNavigator(True))
    test.addStep("Add a new geogig server at the repositories server url")
    test.addStep("Verify the endpoint item has been correctly added (might contain child repos or not)")
    tests.append(test)

    test = GeoGigTest("Connect to wrong endpoint")
    test.addStep("Open navigator", lambda:  _openNavigator(True))
    test.addStep("Add a new geogig server at 'http://wrong.url'")
    test.addStep("Verify a warning indicating that the url is wrong is shown. Verify endpoint item is added to tree and grayed out.")
    tests.append(test)

    test = GeoGigTest("Add layer without repo")
    test.addStep("Open test data", lambda: openTestProject("points"))
    test.addStep("Open navigator", lambda:  _openNavigator(True))
    test.addStep("Right click on the layer and try to add it to a repository.\n"
                 "Verify that it shows a warning because there are no repositories defined.")
    tests.append(test)

    test = GeoGigTest("Add layer to repository")
    test.addStep("Open test data", lambda: openTestProject("points"))
    test.addStep("Create repository", lambda: _createEmptyTestRepo(True))
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Add layer 'points' to the 'empty' repository using navigator button 'Add layer")
    test.addStep("Check layer has been added to repo", _checkLayerInRepo)
    tests.append(test)

    test = GeoGigTest("Check repository log")
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Create repository", lambda: _createSimpleTestRepo())
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Check log is correctly displayed in the history tab of the GeoGig navigator")
    tests.append(test)

    test = GeoGigTest("Open repository layers in QGIS")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("New project", iface.newProject)
    test.addStep("Add layer from the 'simple' repository into QGIS. Use the links in the repository description panel")
    test.addStep("Check layer has been added to project", _checkLayerInProject)
    tests.append(test)

    test = GeoGigTest("Open repository layers in QGIS from tree")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("New project", iface.newProject)
    test.addStep("Add layer from the 'simple' repository into QGIS. Use the links in the layer items of the repository tree")
    test.addStep("Check layer has been added to project", _checkLayerInProject)
    tests.append(test)

    test = GeoGigTest("Open already exported layers in QGIS from tree")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export repo layer", _exportAndChangeToFirstVersion)
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Add layer from the 'simple' repository into QGIS. Use the links in the layer items of the repository tree (which should be in orange color). "
                 "Verify that is asks you for confirmation. Select 'Use branch version'", isVerifyStep = True)
    test.addStep("Check context menu info", lambda: _checkContextMenuInfo("third"))
    tests.append(test)

    test = GeoGigTest("Open already exported layers in QGIS when there are local changes")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export repo layer", _exportAndEditLayer)
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Add layer from the 'simple' repository into QGIS. Use the links in the layer items of the repository tree. "
                 "Verify it show a message in the message bar saying that the layer was already loaded", isVerifyStep = True)
    tests.append(test)

    test = GeoGigTest("Open already exported layers in QGIS to an older version, with local changes")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export repo layer", _exportChangetoFirstVersionAndEditLayer)
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Add layer from the 'simple' repository into QGIS. Use the links in the layer items of the repository tree (which should be in orange color).  "
                 "Verify that is asks you for confirmation. Select 'Use branch version'. Check it is not permitted due to local changes in the layer",
                 isVerifyStep = True)
    tests.append(test)

    test = GeoGigTest("Change layer version")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export repo layer", _exportAndChangeToFirstVersion)
    test.addStep("Change version to 'third' using the 'Change version' menu entry in the layer context menu")
    test.addStep("Check layer has been added to project", _checkLayerInProject)
    test.addStep("Check context menu info", lambda: _checkContextMenuInfo("third"))
    tests.append(test)

    test = GeoGigTest("Change layer version when there are local changes")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export repo layer", _exportAndEditLayer)
    test.addStep("Try to change version using the 'Change version' menu entry in the layer context menu."
                 "Check it is not permitted due to local changes in the layer", isVerifyStep = True)
    tests.append(test)

    test = Test("Sync with only local changes")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Export and edit repo layer", _exportAndEditLayer)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch'. Sync with master branch'")
    test.addStep("Check in repo history that a new version has been created")
    tests.append(test)

    test = Test("Sync to non-master branch")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Export and edit repo layer", _exportAndEditLayer)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch'. Select 'mybranch' in the branch box and sync'")
    test.addStep("Check in repo history that the 'mybranch' branch has been updated with the changes")
    tests.append(test)


    test = Test("Sync with only upstream changes")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Export repo layer", _exportAndChangeToFirstVersion)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch'. Sync with master branch'")
    test.addStep("Check context menu info", lambda: _checkContextMenuInfo("third"))
    test.addStep("Check that layer has been modified")
    tests.append(test)

    test = Test("Sync with no changes at all")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export repo layer", _exportLayer)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch'. Sync with master branch'")
    test.addStep("Check context menu info", lambda: _checkContextMenuInfo("third"))
    test.addStep("Check that no changes are made in the layer or the history")
    tests.append(test)

    test = Test("Merge without conflicts")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Create merge conflict", _createMergeScenario)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Merge 'mybranch' branch into 'master' branch")
    test.addStep("Check that the merge was correctly completed")
    tests.append(test)

    test = Test("Merge with conflicts")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Create merge conflict", _createMergeConflict)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Merge 'mybranch' branch into 'master' branch. Solve conflict")
    test.addStep("Check that the merge was correctly completed")
    tests.append(test)

    test = Test("Merge with conflicts in several layers")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createMultilayerTestRepo(True))
    test.addStep("Create merge conflict", _createMergeConflictInSeveralLayers)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Merge 'mybranch' branch into 'master' branch. Solve conflict")
    test.addStep("Check that the merge was correctly completed")
    tests.append(test)

    test = Test("Sync with conflicts")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export and edit repo layer", _exportAndCreateConflict)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch'. Sync with master branch. Solve conflict'")
    test.addStep("Check that new version has been created in the repo history")
    tests.append(test)

    test = Test("Sync with conflict, with remove and modify")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export and edit repo layer", _exportAndCreateConflictWithRemoveAndModify)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch'. Sync with master branch. Solve conflict'")
    test.addStep("Check that new version has been created in the repo history")
    tests.append(test)

    test = Test("Sync with conflicts and null values")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export and edit repo layer", _exportAndCreateConflictWithNulls)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch'. Sync with master branch. Solve conflict with a new feature'")
    test.addStep("Check that new version has been created in the repo history")
    tests.append(test)

    test = Test("Sync with conflicts, without resolving them")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export and edit repo layer", _exportAndCreateConflict)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch'. Sync with master branch. Exit conflict dialog without solving'")
    test.addStep("Check that no new version has been created in the repo history, and the layer hasn't been modified")
    tests.append(test)

    test = Test("Sync with both local and upstream changes, without conflict")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Export and edit repo layer", _exportAndAddFeatureToLayer)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch. Sync with master branch'")
    test.addStep("Check that layer has been modified and a new version has been created in the repo history")
    tests.append(test)

    test = Test("Sync with layer only in one branch")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Export repo layer", _exportLayer)
    test.addStep("Delete layer from branch", _deleteLayerFromBranch)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Sync with repository branch. Verify that only 'master'branch is available")
    tests.append(test)

    test = Test("Pull with conflicts")
    test.addStep("New project", iface.newProject)
    test.addStep("Prepare test", _createConflictedPullScenario)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Select the repository in the repository explorer. Click on the 'Pull from remote' button and pull from 'myremote' into'master' branch. It will warn you of existing conflict. Solve conflicts and verify it finishes the pull operation correctly.")
    tests.append(test)

    test = Test("Check diff viewer")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo())
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Click on latest version and select 'View changes'. Check that diff viewer works correctly")
    tests.append(test)

    test = Test("Check local diff viewer")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export and edit repo layer", _exportAndEditLayer)
    test.addStep("Right click on 'points' layer and select 'GeoGig/view local changes'. Check that diff viewer works correctly")
    tests.append(test)

    test = Test("Check export diff layer")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Add commit", _addNewCommit)
    test.addStep("Open navigator",  _openNavigator)
    test.addStep("Click on latest version in master branch and select 'Export diff as layer'. Check that layer is exported correctly")
    tests.append(test)

    test = GeoGigTest("Add layer to repository from context menu")
    test.addStep("Open test data", lambda: openTestProject("points"))
    test.addStep("Create repository", lambda: _createEmptyTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Add layer using context menu")
    test.addStep("Check layer has been added to repo", _checkLayerInRepo)
    test.addStep("Check layer context menus", _checkLayerHasTrackedContextMenus)
    tests.append(test)

    test = GeoGigTest("Show version characteristics")
    test.addStep("Create repository", lambda: _createSimpleTestRepo())
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Right click on repo's last commit and select 'Show detailed description'\nVerify description is correctly shown")
    tests.append(test)

    test = GeoGigTest("Create new branch")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Create new branch at master branch's last commit and verify it is added to history tree")
    tests.append(test)

    test = GeoGigTest("Delete branch")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Verify that 'master' branch cannot be deleted from history tree", isVerifyStep = True)
    test.addStep("Delete 'mybranch' using repo history panel and verify the versions tree is updated")
    tests.append(test)

    test = GeoGigTest("Delete branch in repositories tree")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Verify that 'master' branch cannot be deleted from repositories tree", isVerifyStep = True)
    test.addStep("Delete 'mybranch' from the versions tree and verify the repositories tree is updated")
    tests.append(test)

    test = GeoGigTest("Delete layer in repositories tree, in 'master' branch")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Delete 'points' layer in 'master' branch in repositories tree, and verify the repositories tree is updated correctly")
    tests.append(test)

    test = GeoGigTest("Delete layer in tree, in non-master branch")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Delete 'points' layer in 'mybranch' branch in repositories tree, and verify the versions tree is updated correctly")
    tests.append(test)

    test = GeoGigTest("Delete layer in tree, in all branches")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export repo layer", _exportLayer)
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Delete 'points' layer in 'mybranch' branch in repositories tree, and verify the versions tree is updated correctly."
                 "Verify that the context menu of the layer still shows the tracked layer menus")
    test.addStep("Delete 'points' layer in 'master' branch in repositories tree, and verify the versions tree is updated correctly."
                 "Verify that the context menu of the layer shows the layer as untracked")
    tests.append(test)


    test = GeoGigTest("Create new tag")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Create new tag at current branch's last commit and verify it is added to history tree")
    tests.append(test)

    test = GeoGigTest("Delete tag")
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Delete 'mytag' tag and verify the versions tree is updated")
    tests.append(test)

    test = Test("Check map tools viewer")
    test.addStep("New project", iface.newProject)
    test.addStep("Create repository", lambda: _createSimpleTestRepo(True))
    test.addStep("Export layer", _exportLayer)
    test.addStep("Select the 'GeoGig/Info Tool' menu")
    test.addStep("Select layer", _selectLayer)
    test.addStep("Click on a feature and select 'View authorship'. Verify it shows authorship correctly", isVerifyStep = True)
    test.addStep("Click on a feature and select 'View versions'. Verify it shows feature versions correctly")
    tests.append(test)

    return tests
Example #29
0
 def testRemoveTreeFromBranch(self):
     repo = _createSimpleTestRepo(True)
     self.assertEquals(["points"], repo.trees("mybranch"))
     repo.removetree("points", "me", "*****@*****.**", "mybranch")
     self.assertEquals([], repo.trees("mybranch"))
     self.assertEquals(["points"], repo.trees())
Example #30
0
 def testTags(self):
     repo = _createSimpleTestRepo()
     tags = repo.tags()
     log = repo.log()
     self.assertEqual(1, len(tags))
     self.assertEqual(tags["mytag"], log[0].commitid)
Example #31
0
 def testDiff(self):
     repo = _createSimpleTestRepo()
     log = repo.log()
     self.assertEqual(3, len(log))
     diff = {d.path for d in repo.diff(log[0].commitid, log[1].commitid)}
     self.assertEqual(1, len(diff))
Example #32
0
 def testExportDiff(self):
     repo = _createSimpleTestRepo()
     filename = tempFilename("gpkg")
     repo.exportdiff("HEAD", "HEAD~1", filename)
     self.assertTrue(os.path.exists(filename))
Example #33
0
 def testBranches(self):
     repo = _createSimpleTestRepo()
     self.assertEquals(["master", "mybranch"], repo.branches())
 def testCreateBranch(self):
     repo = _createSimpleTestRepo(True)
     self.assertEquals(["master", "mybranch"], repo.branches())
     repo.createbranch(repo.HEAD, "anotherbranch")
     self.assertEquals({"master", "mybranch", "anotherbranch"}, set(repo.branches()))
     self.assertEqual(repo.revparse(repo.HEAD), repo.revparse("anotherbranch"))
Example #35
0
 def testRemoveBranch(self):
     repo = _createSimpleTestRepo(True)
     self.assertEquals(["master", "mybranch"], repo.branches())
     repo.deletebranch("mybranch")
     self.assertEquals(["master"], repo.branches())