0001-toulouse-maelis-move-referential-functest-72352.patch
functests/toulouse_maelis/conftest.py | ||
---|---|---|
347 | 347 |
@pytest.fixture(scope='session') |
348 | 348 |
def referentials(conn): |
349 | 349 |
url = urlparse.urlparse(conn) |
350 | 350 |
slug = url.path.split('/')[2] |
351 | 351 |
cmd = ( |
352 | 352 |
'passerelle-manage tenant_command cron -v2 --connector toulouse-maelis daily --connector-slug %s --domain %s' |
353 | 353 |
% (slug, url.netloc) |
354 | 354 |
) |
355 |
output = subprocess.run(cmd, shell=True, check=False, stdout=None, stderr=None) |
|
355 |
print('\nupdate referentials (it may last some time)') |
|
356 |
output = subprocess.run(cmd, shell=True, check=False, capture_output=True) |
|
356 | 357 |
assert output.returncode == 0, 'fails to run cron: %s' % cmd |
357 | 358 | |
358 | 359 | |
359 | 360 |
@pytest.fixture(scope='session') |
360 | 361 |
def create_data(request, conn): |
361 | 362 |
name_id = request.config.getoption('--nameid') |
362 | 363 |
unlink(conn, name_id) |
363 | 364 |
lastname = uuid4().hex[0:30] |
functests/toulouse_maelis/test_data.py | ||
---|---|---|
1 |
import pytest |
|
2 |
import requests |
|
3 | ||
4 |
from .conftest import diff |
|
5 | ||
6 | ||
7 |
@pytest.mark.parametrize( |
|
8 |
"ref", |
|
9 |
[ |
|
10 |
'category', |
|
11 |
'child-indicator', |
|
12 |
'civility', |
|
13 |
'country', |
|
14 |
'csp', |
|
15 |
'dietcode', |
|
16 |
'organ', |
|
17 |
'pai', |
|
18 |
'quality', |
|
19 |
'quotient', |
|
20 |
'rl-indicator', |
|
21 |
'situation', |
|
22 |
'street', |
|
23 |
'vaccin', |
|
24 |
], |
|
25 |
) |
|
26 |
def test_referentials(conn, referentials, ref): |
|
27 |
url = conn + '/read-%s-list' % ref |
|
28 |
resp = requests.get(url) |
|
29 |
resp.raise_for_status() |
|
30 |
res = resp.json() |
|
31 |
assert res['err'] == 0 |
|
32 |
assert len(res['data']) > 1 |
|
33 |
for item in res['data']: |
|
34 |
assert 'id' in item |
|
35 |
assert 'text' in item |
|
36 |
assert diff(res['data'], 'test_read_%s_list.json' % ref) |
functests/toulouse_maelis/test_family.py | ||
---|---|---|
144 | 144 |
'mobile': '', |
145 | 145 |
'mail': '', |
146 | 146 |
}, |
147 | 147 |
}, |
148 | 148 |
], |
149 | 149 |
} |
150 | 150 | |
151 | 151 | |
152 |
# @pytest.mark.xfail(run=False) |
|
153 |
@pytest.mark.parametrize( |
|
154 |
"ref", |
|
155 |
[ |
|
156 |
'category', |
|
157 |
'child-indicator', |
|
158 |
'civility', |
|
159 |
'country', |
|
160 |
'csp', |
|
161 |
'dietcode', |
|
162 |
'organ', |
|
163 |
'pai', |
|
164 |
'quality', |
|
165 |
'quotient', |
|
166 |
'rl-indicator', |
|
167 |
'situation', |
|
168 |
'street', |
|
169 |
'vaccin', |
|
170 |
], |
|
171 |
) |
|
172 |
def test_referentials(conn, referentials, ref): |
|
173 |
url = conn + '/read-%s-list' % ref |
|
174 |
resp = requests.get(url) |
|
175 |
resp.raise_for_status() |
|
176 |
res = resp.json() |
|
177 |
assert res['err'] == 0 |
|
178 |
assert len(res['data']) > 1 |
|
179 |
for item in res['data']: |
|
180 |
assert 'id' in item |
|
181 |
assert 'text' in item |
|
182 |
assert diff(res['data'], 'test_read_%s_list.json' % ref) |
|
183 | ||
184 | ||
185 | 152 |
def test_update_family(conn, update_data): |
186 | 153 |
unlink(conn, update_data['name_id']) |
187 | 154 |
link(conn, update_data) |
188 | 155 |
url = conn + '/update-family?NameID=%s' % update_data['name_id'] |
189 | 156 | |
190 | 157 |
# reset fields |
191 | 158 |
family_reset_payload = copy.deepcopy(FAMILY_RESET_PAYLOAD) |
192 | 159 |
family_reset_payload['rl1']['lastname'] = update_data['lastname'] |
193 |
- |