def testConfirmedTypeUpdate(self): print "--------------------------------------------------------------------------------------------" print "\n" print "Testing correct working of georeferenceGetProcess for an objectid for a existing process ..." # First test if it correctly response in case of existing georef process # Create dummy process georefProc = self.dummyProcess self.dbsession.add(georefProc) self.dbsession.flush() params = self.dummyParams params["type"] = "update" params["overwrites"] = georefProc.id request = self.getPOSTRequest(params) response = georeferenceConfirm(request) print "Response - %s"%response self.assertEqual(response['text'], 'Georeference result saved. It will soon be ready for use.', 'The response parameter text is not like expected ...') self.assertTrue('georeferenceid' in response, 'Missing parameter in response ...') self.assertTrue('points' in response, 'Missing parameter in response ...') self.assertEqual(response['points'], 20, 'The response (points) is not like expected ...') self.dbsession.delete(georefProc) self.dbsession.flush()
def testConfirmedTypeNewPassed(self): print "--------------------------------------------------------------------------------------------" print "\n" print "Testing correct working of georeferenceConfirm for valide input parameters ..." # get query params params = self.dummyParams params["type"] = 'new' request = self.getPOSTRequest(params) response = georeferenceConfirm(request) print "Response - %s"%response self.assertEqual(response['text'], 'Georeference result saved. It will soon be ready for use.', 'The response parameter text is not like expected ...') self.assertTrue('georeferenceid' in response, 'Missing parameter in response ...') self.assertTrue('points' in response, 'Missing parameter in response ...') self.assertEqual(response['points'], 20, 'The response (points) is not like expected ...')
def testConfirmedTypeNewFailed(self): print "--------------------------------------------------------------------------------------------" print "\n" print "Testing correct working of georeferenceGetProcess for an objectid for a existing process ..." # First test if it correctly response in case of existing georef process # Create dummy process georefProc = self.dummyProcess self.dbsession.add(georefProc) self.dbsession.flush() params = self.dummyParams params["type"] = "new" request = self.getPOSTRequest(params) response = georeferenceConfirm(request) print "Response - %s"%response self.assertTrue('text' in response, 'Confirmation failed. There is already an active process of type new. Please use the georeferenceid for updating') self.assertEqual(response['georeferenceid'], georefProc.id, 'The response (georeferenceid) is not like expected ...') self.dbsession.delete(georefProc) self.dbsession.flush()