2971 |
2971 |
|
2972 |
2972 |
Link.objects.create(resource=con, family_id='1312', name_id='local')
|
2973 |
2973 |
resp = app.post_json(url + '?NameID=local&child_id=613878', params=params)
|
2974 |
2974 |
assert resp.json['err'] == 'wrong-key'
|
2975 |
2975 |
assert resp.json['err_desc'] == "vaccinList/1/code key value 'plop' do not belong to 'Vaccin' referential"
|
2976 |
2976 |
|
2977 |
2977 |
|
2978 |
2978 |
def test_update_rl_indicator(family_service, con, app):
|
2979 |
|
family_service.add_soap_response('updatePersonIndicatorList', get_xml_file('R_update_indicator.xml'))
|
|
2979 |
def request_check(request):
|
|
2980 |
assert [(x['code'], x['isActive']) for x in request.indicatorList] == [
|
|
2981 |
('AVL', True),
|
|
2982 |
('AVS', False),
|
|
2983 |
('ETABSPEC', True),
|
|
2984 |
('MDPH', False),
|
|
2985 |
]
|
|
2986 |
|
|
2987 |
family_service.add_soap_response(
|
|
2988 |
'updatePersonIndicatorList',
|
|
2989 |
get_xml_file('R_update_indicator.xml'),
|
|
2990 |
request_check=request_check,
|
|
2991 |
)
|
2980 |
2992 |
url = get_endpoint('update-rl-indicator')
|
2981 |
2993 |
params = {
|
2982 |
|
'indicatorList': [
|
2983 |
|
{
|
2984 |
|
'code': 'AVL',
|
2985 |
|
'isActive': True,
|
2986 |
|
},
|
2987 |
|
{
|
2988 |
|
'code': 'ETABSPEC',
|
2989 |
|
'note': 'SNPP',
|
2990 |
|
'isActive': True,
|
2991 |
|
},
|
2992 |
|
],
|
|
2994 |
'indicatorList/0/code': 'AVL',
|
|
2995 |
'indicatorList/0/isActive': True,
|
|
2996 |
'indicatorList/1/code': 'AVS',
|
|
2997 |
'indicatorList/1/isActive': False,
|
|
2998 |
'indicatorList/2/code': 'ETABSPEC',
|
|
2999 |
'indicatorList/2/note': 'SNPP',
|
|
3000 |
'indicatorList/2/isActive': 'True',
|
|
3001 |
'indicatorList/3/code': 'MDPH',
|
|
3002 |
'indicatorList/3/isActive': 'False',
|
2993 |
3003 |
}
|
2994 |
3004 |
|
2995 |
3005 |
Link.objects.create(resource=con, family_id='1312', name_id='local')
|
2996 |
3006 |
resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params)
|
2997 |
3007 |
assert resp.json['err'] == 0
|
2998 |
3008 |
assert resp.json['data'] == 'ok'
|
2999 |
3009 |
|
3000 |
3010 |
|
... | ... | |
3009 |
3019 |
],
|
3010 |
3020 |
}
|
3011 |
3021 |
|
3012 |
3022 |
resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params)
|
3013 |
3023 |
assert resp.json['err'] == 'not-linked'
|
3014 |
3024 |
assert resp.json['err_desc'] == 'User not linked to family'
|
3015 |
3025 |
|
3016 |
3026 |
|
|
3027 |
@pytest.mark.parametrize('value', ['plop', '', 2, 0.5, 'N'])
|
|
3028 |
def test_update_rl_indicator_schema_error(value, con, app):
|
|
3029 |
url = get_endpoint('update-rl-indicator')
|
|
3030 |
params = {
|
|
3031 |
'indicatorList/0/code': 'AVL',
|
|
3032 |
'indicatorList/0/isActive': value,
|
|
3033 |
}
|
|
3034 |
|
|
3035 |
Link.objects.create(resource=con, family_id='1312', name_id='local')
|
|
3036 |
resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params, status=400)
|
|
3037 |
assert resp.json['err'] == 1
|
|
3038 |
assert resp.json['err_class'] == 'passerelle.utils.jsonresponse.APIError'
|
|
3039 |
assert "is not of type 'boolean'" in resp.json['err_desc']
|
|
3040 |
|
|
3041 |
|
3017 |
3042 |
def test_update_rl_indicator_no_indicator_error(con, app):
|
3018 |
3043 |
url = get_endpoint('update-rl-indicator')
|
3019 |
3044 |
params = {'indicatorList': []}
|
3020 |
3045 |
|
3021 |
3046 |
Link.objects.create(resource=con, family_id='1312', name_id='local')
|
3022 |
3047 |
resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params, status=400)
|
3023 |
3048 |
assert resp.json['err'] == 1
|
3024 |
3049 |
assert resp.json['err_desc'] == 'indicatorList: [] is too short'
|
... | ... | |
3057 |
3082 |
assert resp.json['err'] == 'wrong-key'
|
3058 |
3083 |
assert (
|
3059 |
3084 |
resp.json['err_desc']
|
3060 |
3085 |
== "indicatorList/0/code key value 'plop' do not belong to 'RLIndicator' required referential"
|
3061 |
3086 |
)
|
3062 |
3087 |
|
3063 |
3088 |
|
3064 |
3089 |
def test_update_child_indicator(family_service, con, app):
|
3065 |
|
family_service.add_soap_response('updatePersonIndicatorList', get_xml_file('R_update_indicator.xml'))
|
|
3090 |
def request_check(request):
|
|
3091 |
assert [(x['code'], x['isActive']) for x in request.indicatorList] == [
|
|
3092 |
('APPDENTAIRE', True),
|
|
3093 |
('AUTRE', False),
|
|
3094 |
('AVL', True),
|
|
3095 |
('AVS', False),
|
|
3096 |
('ETABSPEC', True),
|
|
3097 |
('LENTILLE', False),
|
|
3098 |
('LUNETTE', True),
|
|
3099 |
('MDPH', False),
|
|
3100 |
]
|
|
3101 |
|
|
3102 |
family_service.add_soap_response(
|
|
3103 |
'updatePersonIndicatorList',
|
|
3104 |
get_xml_file('R_update_indicator.xml'),
|
|
3105 |
request_check=request_check,
|
|
3106 |
)
|
3066 |
3107 |
url = get_endpoint('update-child-indicator')
|
3067 |
3108 |
params = {
|
3068 |
|
'indicatorList': [
|
3069 |
|
{
|
3070 |
|
'code': 'LUNETTE',
|
3071 |
|
'isActive': True,
|
3072 |
|
},
|
3073 |
|
{
|
3074 |
|
'code': 'AUTRE',
|
3075 |
|
'note': 'rebellious',
|
3076 |
|
'isActive': True,
|
3077 |
|
},
|
3078 |
|
],
|
|
3109 |
'indicatorList/0/code': 'APPDENTAIRE',
|
|
3110 |
'indicatorList/0/isActive': 1,
|
|
3111 |
'indicatorList/1/code': 'AUTRE',
|
|
3112 |
'indicatorList/1/note': 'rebellious',
|
|
3113 |
'indicatorList/1/isActive': 0,
|
|
3114 |
'indicatorList/2/code': 'AVL',
|
|
3115 |
'indicatorList/2/isActive': '1',
|
|
3116 |
'indicatorList/3/code': 'AVS',
|
|
3117 |
'indicatorList/3/isActive': '0',
|
|
3118 |
'indicatorList/4/code': 'ETABSPEC',
|
|
3119 |
'indicatorList/4/note': 'xxx',
|
|
3120 |
'indicatorList/4/isActive': 'Oui',
|
|
3121 |
'indicatorList/5/code': 'LENTILLE',
|
|
3122 |
'indicatorList/5/isActive': 'Non',
|
|
3123 |
'indicatorList/6/code': 'LUNETTE',
|
|
3124 |
'indicatorList/6/isActive': 'TRUE',
|
|
3125 |
'indicatorList/7/code': 'MDPH',
|
|
3126 |
'indicatorList/7/isActive': 'FALSE',
|
3079 |
3127 |
}
|
3080 |
3128 |
|
3081 |
3129 |
Link.objects.create(resource=con, family_id='1312', name_id='local')
|
3082 |
3130 |
resp = app.post_json(url + '?NameID=local&child_id=613880', params=params)
|
3083 |
3131 |
assert resp.json['err'] == 0
|
3084 |
3132 |
assert resp.json['data'] == 'ok'
|
3085 |
3133 |
|
3086 |
3134 |
|
3087 |
|
-
|