Skip to content

Commit 985c8a9

Browse files
committed
Fix tests
1 parent 720abd9 commit 985c8a9

File tree

4 files changed

+30
-28
lines changed

4 files changed

+30
-28
lines changed

fixtures/search.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"pk": 1,
55
"fields": {
66
"title": "ISIMIP simulation round",
7-
"attribute": "simulation_round",
7+
"identifier": "simulation_round",
88
"order": 1
99
}
1010
},
@@ -13,7 +13,7 @@
1313
"pk": 2,
1414
"fields": {
1515
"title": "Data product",
16-
"attribute": "product",
16+
"identifier": "product",
1717
"order": 2
1818
}
1919
},
@@ -22,7 +22,7 @@
2222
"pk": 3,
2323
"fields": {
2424
"title": "Input category",
25-
"attribute": "category",
25+
"identifier": "category",
2626
"order": 14
2727
}
2828
},
@@ -31,7 +31,7 @@
3131
"pk": 5,
3232
"fields": {
3333
"title": "Climate scenario",
34-
"attribute": "climate_scenario",
34+
"identifier": "climate_scenario",
3535
"order": 8
3636
}
3737
},
@@ -40,7 +40,7 @@
4040
"pk": 8,
4141
"fields": {
4242
"title": "Climate forcing",
43-
"attribute": "climate_forcing",
43+
"identifier": "climate_forcing",
4444
"order": 7
4545
}
4646
},
@@ -49,7 +49,7 @@
4949
"pk": 18,
5050
"fields": {
5151
"title": "Climate variable",
52-
"attribute": "climate_variable",
52+
"identifier": "climate_variable",
5353
"order": 17
5454
}
5555
},
@@ -58,7 +58,7 @@
5858
"pk": 19,
5959
"fields": {
6060
"title": "Input subcategory",
61-
"attribute": "subcategory",
61+
"identifier": "subcategory",
6262
"order": 15
6363
}
6464
},
@@ -67,7 +67,7 @@
6767
"pk": 20,
6868
"fields": {
6969
"title": "Socio-economic scenario",
70-
"attribute": "soc_scenario",
70+
"identifier": "soc_scenario",
7171
"order": 9
7272
}
7373
},
@@ -76,7 +76,7 @@
7676
"pk": 21,
7777
"fields": {
7878
"title": "Socio-economic dataset",
79-
"attribute": "soc_dataset",
79+
"identifier": "soc_dataset",
8080
"order": 16
8181
}
8282
},
@@ -85,7 +85,7 @@
8585
"pk": 22,
8686
"fields": {
8787
"title": "Geographic dataset",
88-
"attribute": "geo_dataset",
88+
"identifier": "geo_dataset",
8989
"order": 18
9090
}
9191
},
@@ -94,7 +94,7 @@
9494
"pk": 23,
9595
"fields": {
9696
"title": "Output variable",
97-
"attribute": "variable",
97+
"identifier": "variable",
9898
"order": 13
9999
}
100100
},
@@ -103,7 +103,7 @@
103103
"pk": 24,
104104
"fields": {
105105
"title": "Temporal resolution",
106-
"attribute": "time_step",
106+
"identifier": "time_step",
107107
"order": 11
108108
}
109109
},
@@ -112,7 +112,7 @@
112112
"pk": 25,
113113
"fields": {
114114
"title": "Sector",
115-
"attribute": "sector",
115+
"identifier": "sector",
116116
"order": 4
117117
}
118118
},
@@ -121,7 +121,7 @@
121121
"pk": 26,
122122
"fields": {
123123
"title": "Impact model",
124-
"attribute": "model",
124+
"identifier": "model",
125125
"order": 5
126126
}
127127
},
@@ -130,7 +130,7 @@
130130
"pk": 27,
131131
"fields": {
132132
"title": "Simulation period",
133-
"attribute": "period",
133+
"identifier": "period",
134134
"order": 3
135135
}
136136
},
@@ -139,7 +139,7 @@
139139
"pk": 28,
140140
"fields": {
141141
"title": "Sensitivity scenario",
142-
"attribute": "sens_scenario",
142+
"identifier": "sens_scenario",
143143
"order": 10
144144
}
145145
},
@@ -148,7 +148,7 @@
148148
"pk": 29,
149149
"fields": {
150150
"title": "Spacial resolution",
151-
"attribute": "resolution",
151+
"identifier": "resolution",
152152
"order": 12
153153
}
154154
}

isimip_data/annotations/tests/test_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@ def test_query_datasets_before(db):
2525

2626

2727
def test_format_affected_datasets(db):
28-
affected_datasets = format_affected_datasets(Dataset.objects.filter(specifiers__contains={'model': 'model'}))
28+
affected_datasets = format_affected_datasets(
29+
Dataset.objects.using('metadata').filter(specifiers__contains={'model': 'model'})
30+
)
2931
assert len(re.findall(r'<br>', affected_datasets)) == 1

testing/fixtures/search.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"pk": 1,
55
"fields": {
66
"title": "Simulation round",
7-
"attribute": "simulation_round",
7+
"identifier": "simulation_round",
88
"order": 1
99
}
1010
},
@@ -13,7 +13,7 @@
1313
"pk": 2,
1414
"fields": {
1515
"title": "Product",
16-
"attribute": "product",
16+
"identifier": "product",
1717
"order": 2
1818
}
1919
},
@@ -22,7 +22,7 @@
2222
"pk": 3,
2323
"fields": {
2424
"title": "Sector",
25-
"attribute": "sector",
25+
"identifier": "sector",
2626
"order": 3
2727
}
2828
},
@@ -31,7 +31,7 @@
3131
"pk": 4,
3232
"fields": {
3333
"title": "Impact model",
34-
"attribute": "model",
34+
"identifier": "model",
3535
"order": 4
3636
}
3737
}

testing/sql/test_isimip_metadata.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ CREATE TABLE public.datasets (
6161
ALTER TABLE public.datasets OWNER TO isimip_metadata;
6262

6363
--
64-
-- Name: attributes; Type: MATERIALIZED VIEW; Schema: public; Owner: isimip_metadata
64+
-- Name: identifiers; Type: MATERIALIZED VIEW; Schema: public; Owner: isimip_metadata
6565
--
6666

67-
CREATE MATERIALIZED VIEW public.attributes AS
67+
CREATE MATERIALIZED VIEW public.identifiers AS
6868
SELECT specifiers.key AS identifier,
6969
array_agg(DISTINCT specifiers.value) AS specifiers
7070
FROM public.datasets,
@@ -74,7 +74,7 @@ CREATE MATERIALIZED VIEW public.attributes AS
7474
WITH NO DATA;
7575

7676

77-
ALTER TABLE public.attributes OWNER TO isimip_metadata;
77+
ALTER TABLE public.identifiers OWNER TO isimip_metadata;
7878

7979
--
8080
-- Name: files; Type: TABLE; Schema: public; Owner: isimip_metadata
@@ -261,7 +261,7 @@ ALTER TABLE ONLY public.trees
261261
-- Name: attributes_identifier_idx; Type: INDEX; Schema: public; Owner: isimip_metadata
262262
--
263263

264-
CREATE INDEX attributes_identifier_idx ON public.attributes USING btree (identifier);
264+
CREATE INDEX identifiers_identifier_idx ON public.identifiers USING btree (identifier);
265265

266266

267267
--
@@ -389,10 +389,10 @@ ALTER TABLE ONLY public.resources_datasets
389389

390390

391391
--
392-
-- Name: attributes; Type: MATERIALIZED VIEW DATA; Schema: public; Owner: isimip_metadata
392+
-- Name: identifiers; Type: MATERIALIZED VIEW DATA; Schema: public; Owner: isimip_metadata
393393
--
394394

395-
REFRESH MATERIALIZED VIEW public.attributes;
395+
REFRESH MATERIALIZED VIEW public.identifiers;
396396

397397

398398
--

0 commit comments

Comments
 (0)