From 7c4748b51cb9d70031e26995b3c2a17343304668 Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Fri, 23 Feb 2018 12:05:51 +0100 Subject: [PATCH] Improve tests (#1379) --- .../lib/Lemonldap/NG/Manager/Attributes.pm | 20 +++++++++---------- .../Lemonldap/NG/Manager/Build/Attributes.pm | 20 +++++++++++-------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Attributes.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Attributes.pm index e92207207..1a93f1e51 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Attributes.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Attributes.pm @@ -2363,24 +2363,24 @@ qr/(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.] 'type' => 'int' }, 'rest2fInitArgs' => { - 'keyTest' => qr/^\S+$/, - 'test' => sub { - 1; - }, - 'type' => 'keyTextContainer' + 'keyMsgFail' => '__badKeyName__', + 'keyTest' => qr/^\w+$/, + 'msgFail' => '__badValue__', + 'test' => qr/^\w+$/, + 'type' => 'keyTextContainer' }, 'rest2fInitUrl' => { 'type' => 'url' }, 'rest2fVerifyArgs' => { - 'keyTest' => qr/^\S+$/, - 'test' => sub { - 1; - }, 'type' => 'keyTextContainer' }, 'rest2fVerifyUrl' => { - 'type' => 'url' + 'keyMsgFail' => '__badKeyName__', + 'keyTest' => qr/^\w+$/, + 'msgFail' => '__badValue__', + 'test' => qr/^\w+$/, + 'type' => 'url' }, 'restAuthUrl' => { 'type' => 'url' diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Build/Attributes.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Build/Attributes.pm index 7a6ccaf8d..86add11ad 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Build/Attributes.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Build/Attributes.pm @@ -1093,23 +1093,27 @@ sub attributes { documentation => 'REST second factor activation', }, rest2fInitUrl => { - type => 'url', + type => 'url', documentation => 'REST 2F init URL', }, rest2fInitArgs => { - type => 'keyTextContainer', - keyTest => qr/^\S+$/, - test => sub { 1 }, + type => 'keyTextContainer', + keyTest => qr/^\w+$/, + keyMsgFail => '__badKeyName__', + test => qr/^\w+$/, + msgFail => '__badValue__', documentation => 'Args for REST 2F init', }, rest2fVerifyUrl => { - type => 'url', + type => 'url', + keyTest => qr/^\w+$/, + keyMsgFail => '__badKeyName__', + test => qr/^\w+$/, + msgFail => '__badValue__', documentation => 'REST 2F init URL', }, rest2fVerifyArgs => { - type => 'keyTextContainer', - keyTest => qr/^\S+$/, - test => sub { 1 }, + type => 'keyTextContainer', documentation => 'Args for REST 2F init', }, rest2fAuthnLevel => {