This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
mandaye-meyzieu/rp_meyzieu/mappers/portail_famille_ecities.py

88 lines
2.5 KiB
Python

"""
You need to defined 3 variables :
* form_values (defined the login form values):
form_values = {
'login_url': '/login',
'post_url': '/login',
'form_attrs': { 'name': 'form40', },
'username_field': 'user',
'password_field': 'pass',
'post_fields': ['birthdate', 'card_number']
}
login_url, form_attrs, post_fields and username_field are obligatory
* urls (a dictionnary with urls) :
urls = {
'associate_url': '/mandaye/associate',
'connection_url': '/mandaye/sso',
'login_url': '/mandaye/login'
}
* mapping
"""
from rp_meyzieu.filters.example import ReplayFilter
form_values = {
'login_url': '/ffaxsslMeyzieu/workflow_url',
'form_attrs': { 'name': 'eCitiz' },
'post_fields': ['MonIdentifiant_champcalcule6', 'MonMotDePasse_champcalcule9', 'egoPage', 'workflow', 'egoToken', 'egoSubmitMeConnecter_action133_6T9N'],
'username_field': 'MonIdentifiant_champcalcule6',
'password_field': 'MonMotDePasse_champcalcule9',
}
urls = {
'associate_url': '/mandaye/associate',
'connection_url': '/mandaye/sso',
'login_url': '/mandaye/login'
}
mapping = [
{
'path': r'/mandaye/login$',
'method': 'GET',
'response': [{
'auth': 'login',
'condition': 'response.code==302',
},]
},
{
'path': r'/mandaye/sso$',
'method': 'GET',
'response': [{
'auth': 'sso',
}]
},
{
'path': r'/mandaye/slo$',
'method': 'GET',
'response': [{
'auth': 'slo',
}]
},
{
'path': r'/mandaye/associate$',
'method': 'GET',
'on_response': [{
'filter': ReplayFilter.associate,
'values': {
'action': urls['associate_url'],
'template': 'portail_famille/associate.html',
'login_name': form_values['username_field'],
'password_name': form_values['password_field'],
},
},]
},
{
'path': r'/mandaye/associate$',
'method': 'POST',
'response': [
{
'auth': 'associate_submit',
'condition': "response.code==302"
},
]
},
]