@@ -506,6 +506,86 @@ def test_result_descriptor(self):
506506 self .assertEqual (str (exception .exception ),
507507 'NotFound: Not Found' )
508508
509+ def test_workflow_retrieval (self ):
510+ workflow_definition = {
511+ "type" : "Vector" ,
512+ "operator" : {
513+ "type" : "RasterVectorJoin" ,
514+ "params" : {
515+ "names" : [
516+ "NDVI"
517+ ],
518+ "featureAggregation" : "first" ,
519+ "temporalAggregation" : "none"
520+ },
521+ "sources" : {
522+ "vector" : {
523+ "type" : "OgrSource" ,
524+ "params" : {
525+ "dataset" : {
526+ "type" : "internal" ,
527+ "datasetId" : "a9623a5b-b6c5-404b-bc5a-313ff72e4e75"
528+ },
529+ "attributeProjection" : None
530+ }
531+ },
532+ "rasters" : [
533+ {
534+ "type" : "GdalSource" ,
535+ "params" : {
536+ "dataset" : {
537+ "type" : "internal" ,
538+ "datasetId" : "36574dc3-560a-4b09-9d22-d5945f2b8093"
539+ }
540+ }
541+ }
542+ ]
543+ }
544+ }
545+ }
546+
547+ with requests_mock .Mocker () as m :
548+ m .post ('http://mock-instance/anonymous' , json = {
549+ "id" : "c4983c3e-9b53-47ae-bda9-382223bd5081" ,
550+ "project" : None ,
551+ "view" : None
552+ })
553+
554+ m .post ('http://mock-instance/workflow' ,
555+ json = {
556+ "id" : "4a2cb6e0-a3e3-53e4-9a0f-ed1cf2e4c3b7"
557+ },
558+ request_headers = {'Authorization' : 'Bearer c4983c3e-9b53-47ae-bda9-382223bd5081' })
559+
560+ m .get ('http://mock-instance/workflow/4a2cb6e0-a3e3-53e4-9a0f-ed1cf2e4c3b7/metadata' ,
561+ json = {
562+ "type" : "vector" ,
563+ "dataType" : "MultiPoint" ,
564+ "spatialReference" : "EPSG:4326" ,
565+ "columns" : {
566+ "name" : "text" ,
567+ "scalerank" : "int" ,
568+ "NDVI" : "int" ,
569+ "natlscale" : "float" ,
570+ "featurecla" : "text" ,
571+ "website" : "text"
572+ }
573+ },
574+ request_headers = {'Authorization' : 'Bearer c4983c3e-9b53-47ae-bda9-382223bd5081' })
575+
576+ m .get ('http://mock-instance/workflow/4a2cb6e0-a3e3-53e4-9a0f-ed1cf2e4c3b7' ,
577+ json = workflow_definition ,
578+ request_headers = {'Authorization' : 'Bearer c4983c3e-9b53-47ae-bda9-382223bd5081' })
579+
580+ ge .initialize ("http://mock-instance" )
581+
582+ workflow = ge .register_workflow (workflow_definition )
583+
584+ self .assertEqual (
585+ workflow .workflow_definition (),
586+ workflow_definition
587+ )
588+
509589
510590if __name__ == '__main__' :
511591 unittest .main ()
0 commit comments