Newer
Older

Karine PARRA
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
from source.simulation_parameters import *
import os
WRITE_IN_NAOS: bool = True
# change here to you personal token in order to run the test
NAOS_TOKEN = "my token"
os.environ["WRITE_IN_NAOS"] = str(WRITE_IN_NAOS)
os.environ["NAOS_TOKEN"] = NAOS_TOKEN
def test_end_to_end_3d_ok():
simulation_parameters_3d = SimulationParameters(
model="gironde-xl-3d",
project_id=899, # https://forge.naos-cluster.tech/gpmb/modeles-telemac/fork-target/do-not-use-tests-project
sources=['open-meteo', 'magest', 'constants-3d', 'hub-eau-3d', 'copernicus-o2', 'copernicus-temp'],
start_date="2024-06-23T00:00:00.000000Z",
end_date="2024-06-24T00:00:00.000000Z",
naos_token=NAOS_TOKEN,
write_in_naos=WRITE_IN_NAOS,
)
result_creation = simulation_parameters_3d.create_simulation()["error"]
assert result_creation == 0
with open("data/forcage_FRLIQ_ST.dat", "r") as file:
expected_forcage_frliq = file.read()
result_forcage_frliq = get_project_file(899, "forcage_FRLIQ_ST.dat", NAOS_TOKEN)
assert expected_forcage_frliq == result_forcage_frliq
with open("data/forcage_atmos_OM.dat", "r") as file:
expected_forcage_atmos = file.read()
result_forcage_atmos = get_project_file(899, "forcage_atmos_OM.dat", NAOS_TOKEN)
assert expected_forcage_atmos == result_forcage_atmos
with open("data/t3d_hydro_R45_waqtel2-gaia_T6_26012023.dat", "r") as file:
expected_t3d = file.read()
result_t3d = get_project_file(899, "t3d_hydro_R45_waqtel2-gaia_T6_26012023.dat", NAOS_TOKEN)
assert expected_t3d == result_t3d
def test_end_to_end_3d_ko():
simulation_parameters_3d = SimulationParameters(
model="gironde-xl-3d",
project_id=899, # https://forge.naos-cluster.tech/gpmb/modeles-telemac/fork-target/do-not-use-tests-project
sources=['open-meteo', 'magest', 'constants-3d', 'hub-eau-3d', 'copernicus-o2', 'copernicus-temp'],
start_date="2022-06-23T00:00:00.000000Z",
end_date="2022-06-24T00:00:00.000000Z",
naos_token=NAOS_TOKEN,
write_in_naos=WRITE_IN_NAOS,
)
result_creation = simulation_parameters_3d.create_simulation()["error"]
assert result_creation == 0
with open("data/forcage_FRLIQ_ST.dat", "r") as file:
expected_forcage_frliq = file.read()
result_forcage_frliq = get_project_file(899, "forcage_FRLIQ_ST.dat", NAOS_TOKEN)
assert expected_forcage_frliq != result_forcage_frliq
with open("data/forcage_atmos_OM.dat", "r") as file:
expected_forcage_atmos = file.read()
result_forcage_atmos = get_project_file(899, "forcage_atmos_OM.dat", NAOS_TOKEN)
assert expected_forcage_atmos != result_forcage_atmos
with open("data/t3d_hydro_R45_waqtel2-gaia_T6_26012023.dat", "r") as file:
expected_t3d = file.read()
result_t3d = get_project_file(899, "t3d_hydro_R45_waqtel2-gaia_T6_26012023.dat", NAOS_TOKEN)
assert expected_t3d != result_t3d
def test_end_to_end_2d_ok():
simulation_parameters_2d = SimulationParameters(
model="houle-2d",
project_id=1045, # https://forge.naos-cluster.tech/gpmb/modeles-telemac/fork-target/do-not-use-tests-project
sources=["constants-2d", "copernicus-sea", "hub-eau-2d", "open-meteo"],
start_date="2024-06-23T00:00:00.000000Z",
end_date="2024-06-24T00:00:00.000000Z",
naos_token=NAOS_TOKEN,
write_in_naos=WRITE_IN_NAOS,
)
result_creation = simulation_parameters_2d.create_simulation()["error"]
assert result_creation == 0
with open("data/debits.dat", "r") as file:
expected_debits = file.read()
result_debits = get_project_file(1045, "debits.dat", NAOS_TOKEN)
assert expected_debits == result_debits
with open("data/meteo_estuaire.dat", "r") as file:
expected_meteo_estuaire = file.read()
result_meteo_estuaire = get_project_file(1045, "meteo_estuaire.dat", NAOS_TOKEN)
assert expected_meteo_estuaire == result_meteo_estuaire
with open("data/T2D_GXL_instat_v8p2.cas", "r") as file:
expected_t2d = file.read()
result_t2d = get_project_file(1045, "T2D_GXL_instat_v8p2.cas", NAOS_TOKEN)
assert expected_t2d == result_t2d
with open("data/TOM_GXL_instat_v8p2.cas", "r") as file:
expected_tom = file.read()
result_tom = get_project_file(1045, "TOM_GXL_instat_v8p2.cas", NAOS_TOKEN)
assert expected_tom == result_tom
with open("data/input_tomawac.dat", "r") as file:
expected_tomawac = file.read()
result_tomawac = get_project_file(1045, "input_tomawac.dat", NAOS_TOKEN)
assert expected_tomawac == result_tomawac
def test_end_to_end_2d_ko():
simulation_parameters_2d = SimulationParameters(
model="houle-2d",
project_id=1045, # https://forge.naos-cluster.tech/gpmb/modeles-telemac/fork-target/do-not-use-tests-project
sources=["constants-2d", "copernicus-sea", "hub-eau-2d", "open-meteo"],
start_date="2022-06-23T00:00:00.000000Z",
end_date="2022-06-24T00:00:00.000000Z",
naos_token=NAOS_TOKEN,
write_in_naos=WRITE_IN_NAOS,
)
result_creation = simulation_parameters_2d.create_simulation()["error"]
assert result_creation == 0
with open("data/debits.dat", "r") as file:
expected_debits = file.read()
result_debits = get_project_file(1045, "debits.dat", NAOS_TOKEN)
assert expected_debits != result_debits
with open("data/meteo_estuaire.dat", "r") as file:
expected_meteo_estuaire = file.read()
result_meteo_estuaire = get_project_file(1045, "meteo_estuaire.dat", NAOS_TOKEN)
assert expected_meteo_estuaire != result_meteo_estuaire
with open("data/T2D_GXL_instat_v8p2.cas", "r") as file:
expected_t2d = file.read()
result_t2d = get_project_file(1045, "T2D_GXL_instat_v8p2.cas", NAOS_TOKEN)
assert expected_t2d != result_t2d
with open("data/TOM_GXL_instat_v8p2.cas", "r") as file:
expected_tom = file.read()
result_tom = get_project_file(1045, "TOM_GXL_instat_v8p2.cas", NAOS_TOKEN)
assert expected_tom != result_tom
with open("data/input_tomawac.dat", "r") as file:
expected_tomawac = file.read()
result_tomawac = get_project_file(1045, "input_tomawac.dat", NAOS_TOKEN)
assert expected_tomawac != result_tomawac