Skip to content

Commit 2e93fa7

Browse files
committed
test: test creation of footprint tutorial
1 parent 68cd66f commit 2e93fa7

File tree

2 files changed

+326
-0
lines changed

2 files changed

+326
-0
lines changed
Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
{
2+
"createdBy": "LtCUyou6CnSSc1H0Q0nDrN97x892",
3+
"customOptions": [
4+
{
5+
"description": "the shape does outline a building in the image",
6+
"icon": "hand-right-outline",
7+
"iconColor": "#00796B",
8+
"subOptions": [
9+
{
10+
"description": "doppelt",
11+
"value": 2
12+
},
13+
{
14+
"description": "dreifach",
15+
"value": 3
16+
}
17+
],
18+
"title": "Jetzt rede ich",
19+
"value": 1
20+
},
21+
{
22+
"description": "the shape doesn't match a building in the image",
23+
"icon": "close-outline",
24+
"iconColor": "#D32F2F",
25+
"title": "No",
26+
"value": 0
27+
}
28+
],
29+
"informationPages": [
30+
{
31+
"blocks": [
32+
{
33+
"blockNumber": 1,
34+
"blockType": "text",
35+
"textDescription": "asdf"
36+
},
37+
{
38+
"blockNumber": 2,
39+
"blockType": "image",
40+
"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"
41+
}
42+
],
43+
"pageNumber": 1,
44+
"title": "asdf"
45+
}
46+
],
47+
"lookFor": "prints",
48+
"name": "Validated/Footprint Mapswipe4Web Tutorial",
49+
"projectType": 2,
50+
"screens": [
51+
null,
52+
{
53+
"instructions": {
54+
"description": "sadf",
55+
"icon": "tap-1",
56+
"title": "sadf"
57+
}
58+
},
59+
{
60+
"instructions": {
61+
"description": "asdf",
62+
"icon": "ellipse-outline",
63+
"title": "asdf"
64+
}
65+
},
66+
{
67+
"instructions": {
68+
"description": "sdaf",
69+
"icon": "flag-outline",
70+
"title": "asdf"
71+
}
72+
},
73+
{
74+
"instructions": {
75+
"description": "sadf",
76+
"icon": "egg-outline",
77+
"title": "asdf"
78+
}
79+
},
80+
{
81+
"instructions": {
82+
"description": "sadf",
83+
"icon": "checkmark-outline",
84+
"title": "asdf"
85+
}
86+
}
87+
],
88+
"tileServer": {
89+
"credits": "© 2019 Microsoft Corporation, Earthstar Geographics SIO",
90+
"name": "bing"
91+
},
92+
"tutorialTasks": {
93+
"crs": {
94+
"properties": {
95+
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
96+
},
97+
"type": "name"
98+
},
99+
"features": [
100+
{
101+
"geometry": {
102+
"coordinates": [
103+
[
104+
[
105+
36.952541,
106+
-1.196843
107+
],
108+
[
109+
36.9526309,
110+
-1.196843
111+
],
112+
[
113+
36.9526309,
114+
-1.1967531
115+
],
116+
[
117+
36.952541,
118+
-1.1967531
119+
],
120+
[
121+
36.952541,
122+
-1.196843
123+
]
124+
]
125+
],
126+
"type": "Polygon"
127+
},
128+
"properties": {
129+
"id": 1543,
130+
"reference": 1,
131+
"screen": 1
132+
},
133+
"type": "Feature"
134+
},
135+
{
136+
"geometry": {
137+
"coordinates": [
138+
[
139+
[
140+
36.9532597,
141+
-1.1998972
142+
],
143+
[
144+
36.9533495,
145+
-1.1998972
146+
],
147+
[
148+
36.9533495,
149+
-1.1998074
150+
],
151+
[
152+
36.9532597,
153+
-1.1998074
154+
],
155+
[
156+
36.9532597,
157+
-1.1998972
158+
]
159+
]
160+
],
161+
"type": "Polygon"
162+
},
163+
"properties": {
164+
"id": 1621,
165+
"reference": 1,
166+
"screen": 2
167+
},
168+
"type": "Feature"
169+
},
170+
{
171+
"geometry": {
172+
"coordinates": [
173+
[
174+
[
175+
36.9537088,
176+
-1.1994481
177+
],
178+
[
179+
36.9537987,
180+
-1.1994481
181+
],
182+
[
183+
36.9537987,
184+
-1.1993582
185+
],
186+
[
187+
36.9537088,
188+
-1.1993582
189+
],
190+
[
191+
36.9537088,
192+
-1.1994481
193+
]
194+
]
195+
],
196+
"type": "Polygon"
197+
},
198+
"properties": {
199+
"id": 1599,
200+
"reference": 0,
201+
"screen": 3
202+
},
203+
"type": "Feature"
204+
},
205+
{
206+
"geometry": {
207+
"coordinates": [
208+
[
209+
[
210+
36.9483189,
211+
-1.1999871
212+
],
213+
[
214+
36.9484088,
215+
-1.1999871
216+
],
217+
[
218+
36.9484088,
219+
-1.1998972
220+
],
221+
[
222+
36.9483189,
223+
-1.1998972
224+
],
225+
[
226+
36.9483189,
227+
-1.1999871
228+
]
229+
]
230+
],
231+
"type": "Polygon"
232+
},
233+
"properties": {
234+
"id": 1639,
235+
"reference": 0,
236+
"screen": 4
237+
},
238+
"type": "Feature"
239+
},
240+
{
241+
"geometry": {
242+
"coordinates": [
243+
[
244+
[
245+
36.9483189,
246+
-1.2001667
247+
],
248+
[
249+
36.9484088,
250+
-1.2001667
251+
],
252+
[
253+
36.9484088,
254+
-1.2000769
255+
],
256+
[
257+
36.9483189,
258+
-1.2000769
259+
],
260+
[
261+
36.9483189,
262+
-1.2001667
263+
]
264+
]
265+
],
266+
"type": "Polygon"
267+
},
268+
"properties": {
269+
"id": 1641,
270+
"reference": 2,
271+
"screen": 5
272+
},
273+
"type": "Feature"
274+
}
275+
],
276+
"name": "tutorial_tasks",
277+
"type": "FeatureCollection"
278+
}
279+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import os
2+
import unittest
3+
4+
from click.testing import CliRunner
5+
6+
from mapswipe_workers import auth, mapswipe_workers
7+
from mapswipe_workers.utils.create_directories import create_directories
8+
from tests import fixtures
9+
from tests.fixtures import FIXTURE_DIR
10+
from tests.integration import tear_down
11+
12+
13+
class TestCreateFootprintTutorial(unittest.TestCase):
14+
def setUp(self):
15+
file_path = os.path.join(FIXTURE_DIR, "tutorialDrafts", "footprint.json")
16+
self.project_id = fixtures.create_test_draft(
17+
file_path,
18+
"footprint",
19+
"footprint",
20+
draftType="tutorialDrafts",
21+
)
22+
create_directories()
23+
24+
def tearDown(self):
25+
tear_down.delete_test_data(self.project_id)
26+
27+
def test_create_completeness_tutorial(self):
28+
runner = CliRunner()
29+
runner.invoke(mapswipe_workers.run_create_tutorials, catch_exceptions=False)
30+
31+
fb_db = auth.firebaseDB()
32+
ref = fb_db.reference(f"/v2/projects/tutorial_{self.project_id}")
33+
result = ref.get(shallow=True)
34+
self.assertIsNotNone(result)
35+
36+
ref = fb_db.reference(f"/v2/groups/tutorial_{self.project_id}")
37+
result = ref.get(shallow=True)
38+
self.assertIsNotNone(result)
39+
40+
# Tile classification projects do not have tasks in Firebase, but tutorials do
41+
ref = fb_db.reference(f"/v2/tasks/tutorial_{self.project_id}")
42+
result = ref.get(shallow=True)
43+
self.assertIsNotNone(result)
44+
45+
46+
if __name__ == "__main__":
47+
unittest.main()

0 commit comments

Comments
 (0)