-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: test creation of footprint tutorial
- Loading branch information
Showing
2 changed files
with
326 additions
and
0 deletions.
There are no files selected for viewing
279 changes: 279 additions & 0 deletions
279
mapswipe_workers/tests/fixtures/tutorialDrafts/footprint.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,279 @@ | ||
{ | ||
"createdBy": "LtCUyou6CnSSc1H0Q0nDrN97x892", | ||
"customOptions": [ | ||
{ | ||
"description": "the shape does outline a building in the image", | ||
"icon": "hand-right-outline", | ||
"iconColor": "#00796B", | ||
"subOptions": [ | ||
{ | ||
"description": "doppelt", | ||
"value": 2 | ||
}, | ||
{ | ||
"description": "dreifach", | ||
"value": 3 | ||
} | ||
], | ||
"title": "Jetzt rede ich", | ||
"value": 1 | ||
}, | ||
{ | ||
"description": "the shape doesn't match a building in the image", | ||
"icon": "close-outline", | ||
"iconColor": "#D32F2F", | ||
"title": "No", | ||
"value": 0 | ||
} | ||
], | ||
"informationPages": [ | ||
{ | ||
"blocks": [ | ||
{ | ||
"blockNumber": 1, | ||
"blockType": "text", | ||
"textDescription": "asdf" | ||
}, | ||
{ | ||
"blockNumber": 2, | ||
"blockType": "image", | ||
"image": "https://firebasestorage.googleapis.com/v0/b/dev-mapswipe.appspot.com/o/tutorialImages%2F1705402528654-block-image-2-base-query-form.png?alt=media&token=54325ab8-c5e7-45a3-be41-1926a5984a05" | ||
} | ||
], | ||
"pageNumber": 1, | ||
"title": "asdf" | ||
} | ||
], | ||
"lookFor": "prints", | ||
"name": "Validated/Footprint Mapswipe4Web Tutorial", | ||
"projectType": 2, | ||
"screens": [ | ||
null, | ||
{ | ||
"instructions": { | ||
"description": "sadf", | ||
"icon": "tap-1", | ||
"title": "sadf" | ||
} | ||
}, | ||
{ | ||
"instructions": { | ||
"description": "asdf", | ||
"icon": "ellipse-outline", | ||
"title": "asdf" | ||
} | ||
}, | ||
{ | ||
"instructions": { | ||
"description": "sdaf", | ||
"icon": "flag-outline", | ||
"title": "asdf" | ||
} | ||
}, | ||
{ | ||
"instructions": { | ||
"description": "sadf", | ||
"icon": "egg-outline", | ||
"title": "asdf" | ||
} | ||
}, | ||
{ | ||
"instructions": { | ||
"description": "sadf", | ||
"icon": "checkmark-outline", | ||
"title": "asdf" | ||
} | ||
} | ||
], | ||
"tileServer": { | ||
"credits": "© 2019 Microsoft Corporation, Earthstar Geographics SIO", | ||
"name": "bing" | ||
}, | ||
"tutorialTasks": { | ||
"crs": { | ||
"properties": { | ||
"name": "urn:ogc:def:crs:OGC:1.3:CRS84" | ||
}, | ||
"type": "name" | ||
}, | ||
"features": [ | ||
{ | ||
"geometry": { | ||
"coordinates": [ | ||
[ | ||
[ | ||
36.952541, | ||
-1.196843 | ||
], | ||
[ | ||
36.9526309, | ||
-1.196843 | ||
], | ||
[ | ||
36.9526309, | ||
-1.1967531 | ||
], | ||
[ | ||
36.952541, | ||
-1.1967531 | ||
], | ||
[ | ||
36.952541, | ||
-1.196843 | ||
] | ||
] | ||
], | ||
"type": "Polygon" | ||
}, | ||
"properties": { | ||
"id": 1543, | ||
"reference": 1, | ||
"screen": 1 | ||
}, | ||
"type": "Feature" | ||
}, | ||
{ | ||
"geometry": { | ||
"coordinates": [ | ||
[ | ||
[ | ||
36.9532597, | ||
-1.1998972 | ||
], | ||
[ | ||
36.9533495, | ||
-1.1998972 | ||
], | ||
[ | ||
36.9533495, | ||
-1.1998074 | ||
], | ||
[ | ||
36.9532597, | ||
-1.1998074 | ||
], | ||
[ | ||
36.9532597, | ||
-1.1998972 | ||
] | ||
] | ||
], | ||
"type": "Polygon" | ||
}, | ||
"properties": { | ||
"id": 1621, | ||
"reference": 1, | ||
"screen": 2 | ||
}, | ||
"type": "Feature" | ||
}, | ||
{ | ||
"geometry": { | ||
"coordinates": [ | ||
[ | ||
[ | ||
36.9537088, | ||
-1.1994481 | ||
], | ||
[ | ||
36.9537987, | ||
-1.1994481 | ||
], | ||
[ | ||
36.9537987, | ||
-1.1993582 | ||
], | ||
[ | ||
36.9537088, | ||
-1.1993582 | ||
], | ||
[ | ||
36.9537088, | ||
-1.1994481 | ||
] | ||
] | ||
], | ||
"type": "Polygon" | ||
}, | ||
"properties": { | ||
"id": 1599, | ||
"reference": 0, | ||
"screen": 3 | ||
}, | ||
"type": "Feature" | ||
}, | ||
{ | ||
"geometry": { | ||
"coordinates": [ | ||
[ | ||
[ | ||
36.9483189, | ||
-1.1999871 | ||
], | ||
[ | ||
36.9484088, | ||
-1.1999871 | ||
], | ||
[ | ||
36.9484088, | ||
-1.1998972 | ||
], | ||
[ | ||
36.9483189, | ||
-1.1998972 | ||
], | ||
[ | ||
36.9483189, | ||
-1.1999871 | ||
] | ||
] | ||
], | ||
"type": "Polygon" | ||
}, | ||
"properties": { | ||
"id": 1639, | ||
"reference": 0, | ||
"screen": 4 | ||
}, | ||
"type": "Feature" | ||
}, | ||
{ | ||
"geometry": { | ||
"coordinates": [ | ||
[ | ||
[ | ||
36.9483189, | ||
-1.2001667 | ||
], | ||
[ | ||
36.9484088, | ||
-1.2001667 | ||
], | ||
[ | ||
36.9484088, | ||
-1.2000769 | ||
], | ||
[ | ||
36.9483189, | ||
-1.2000769 | ||
], | ||
[ | ||
36.9483189, | ||
-1.2001667 | ||
] | ||
] | ||
], | ||
"type": "Polygon" | ||
}, | ||
"properties": { | ||
"id": 1641, | ||
"reference": 2, | ||
"screen": 5 | ||
}, | ||
"type": "Feature" | ||
} | ||
], | ||
"name": "tutorial_tasks", | ||
"type": "FeatureCollection" | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
mapswipe_workers/tests/integration/test_create_arbitrary_geometry_footprint_tutorial.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import os | ||
import unittest | ||
|
||
from click.testing import CliRunner | ||
|
||
from mapswipe_workers import auth, mapswipe_workers | ||
from mapswipe_workers.utils.create_directories import create_directories | ||
from tests import fixtures | ||
from tests.fixtures import FIXTURE_DIR | ||
from tests.integration import tear_down | ||
|
||
|
||
class TestCreateFootprintTutorial(unittest.TestCase): | ||
def setUp(self): | ||
file_path = os.path.join(FIXTURE_DIR, "tutorialDrafts", "footprint.json") | ||
self.project_id = fixtures.create_test_draft( | ||
file_path, | ||
"footprint", | ||
"footprint", | ||
draftType="tutorialDrafts", | ||
) | ||
create_directories() | ||
|
||
def tearDown(self): | ||
tear_down.delete_test_data(self.project_id) | ||
|
||
def test_create_completeness_tutorial(self): | ||
runner = CliRunner() | ||
runner.invoke(mapswipe_workers.run_create_tutorials, catch_exceptions=False) | ||
|
||
fb_db = auth.firebaseDB() | ||
ref = fb_db.reference(f"/v2/projects/tutorial_{self.project_id}") | ||
result = ref.get(shallow=True) | ||
self.assertIsNotNone(result) | ||
|
||
ref = fb_db.reference(f"/v2/groups/tutorial_{self.project_id}") | ||
result = ref.get(shallow=True) | ||
self.assertIsNotNone(result) | ||
|
||
# Tile classification projects do not have tasks in Firebase, but tutorials do | ||
ref = fb_db.reference(f"/v2/tasks/tutorial_{self.project_id}") | ||
result = ref.get(shallow=True) | ||
self.assertIsNotNone(result) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |