More tests

This commit is contained in:
Xavier Guimard 2016-02-09 12:38:43 +00:00
parent bb710cead0
commit 27048b1670
4 changed files with 42 additions and 8 deletions

View File

@ -60,7 +60,15 @@ qr/^(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-
'lmAttrOrMacro' => { 'lmAttrOrMacro' => {
'form' => 'text', 'form' => 'text',
'test' => sub { 'test' => sub {
1; my ( $val, $conf ) = @_;
if ( defined $conf->{'exportedVars'}{$val}
or defined $conf->{'macro'}{$val} )
{
return 1;
}
else {
return 1, '__unknownAttrOrMacro__';
}
} }
}, },
'longtext' => { 'longtext' => {
@ -100,7 +108,9 @@ qr/^(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-
}, },
'password' => { 'password' => {
'msgFail' => '__malformedValue__', 'msgFail' => '__malformedValue__',
'test' => qr/.*/ 'test' => sub {
1;
}
}, },
'pcre' => { 'pcre' => {
'form' => 'text', 'form' => 'text',
@ -196,7 +206,9 @@ qr/^(?:(?:\-+\s*BEGIN\s+(?:PUBLIC\s+KEY|CERTIFICATE)\s*\-+\r?\n)?[a-zA-Z0-9\/\+\
}, },
'text' => { 'text' => {
'msgFail' => '__malformedValue__', 'msgFail' => '__malformedValue__',
'test' => qr/.*/ 'test' => sub {
1;
}
}, },
'trool' => { 'trool' => {
'msgFail' => '__authorizedValues__: -1, 0, 1', 'msgFail' => '__authorizedValues__: -1, 0, 1',
@ -2461,11 +2473,17 @@ qr/^(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.
}, },
'timeout' => { 'timeout' => {
'default' => 72000, 'default' => 72000,
'type' => 'int' 'test' => sub {
$_[0] > 0;
},
'type' => 'int'
}, },
'timeoutActivity' => { 'timeoutActivity' => {
'default' => 0, 'default' => 0,
'type' => 'int' 'test' => sub {
$_[0] >= 0;
},
'type' => 'int'
}, },
'trustedDomains' => { 'trustedDomains' => {
'type' => 'text' 'type' => 'text'

View File

@ -20,11 +20,11 @@ sub types {
# Simple text types # Simple text types
text => { text => {
test => qr/.*/, test => sub { 1 },
msgFail => '__malformedValue__', msgFail => '__malformedValue__',
}, },
password => { password => {
test => qr/.*/, test => sub { 1 },
msgFail => '__malformedValue__', msgFail => '__malformedValue__',
}, },
longtext => { longtext => {
@ -54,7 +54,17 @@ sub types {
}, },
lmAttrOrMacro => { lmAttrOrMacro => {
form => 'text', form => 'text',
test => sub { 1 }, test => sub {
my ( $val, $conf ) = @_;
if ( defined $conf->{exportedVars}->{$val}
or defined $conf->{macro}->{$val} )
{
return 1;
}
else {
return ( 1, '__unknownAttrOrMacro__' );
}
},
}, },
# Other types # Other types
@ -427,11 +437,13 @@ sub attributes {
}, },
timeout => { timeout => {
type => 'int', type => 'int',
test => sub { $_[0] > 0 },
default => 72000, default => 72000,
documentation => 'Session timeout on server side', documentation => 'Session timeout on server side',
}, },
timeoutActivity => { timeoutActivity => {
type => 'int', type => 'int',
test => sub { $_[0] >= 0 },
default => 0, default => 0,
documentation => 'Session activity timeout on server side', documentation => 'Session activity timeout on server side',
}, },

View File

@ -56,6 +56,7 @@
"auto": "Automatic", "auto": "Automatic",
"backtoportal": "Back to portal", "backtoportal": "Back to portal",
"badCookieName": "Bad cookie name", "badCookieName": "Bad cookie name",
"badCustomFuncName": "Bad custom function name",
"badDomainName": "Bad domain name", "badDomainName": "Bad domain name",
"badEncoding": "Bad encoding", "badEncoding": "Bad encoding",
"badExpression": "Bad expression", "badExpression": "Bad expression",
@ -585,6 +586,7 @@
"twitterParams": "Twitter parameters", "twitterParams": "Twitter parameters",
"twitterSecret": "API secret", "twitterSecret": "API secret",
"uid": "Identifier", "uid": "Identifier",
"unknownAttrOrMacro": "Unknown attribute or macro",
"unknownError": "Unknown error", "unknownError": "Unknown error",
"unknownKey": "Unknown key", "unknownKey": "Unknown key",
"unsecuredCookie": "Unsecured cookie", "unsecuredCookie": "Unsecured cookie",

View File

@ -56,6 +56,7 @@
"auto": "Automatique", "auto": "Automatique",
"backtoportal": "Retour au portail", "backtoportal": "Retour au portail",
"badCookieName": "Mauvais nom de cookie", "badCookieName": "Mauvais nom de cookie",
"badCustomFuncName": "Mauvais nom de fonction personnalisée",
"badDomainName": "Mauvais nom de domaine", "badDomainName": "Mauvais nom de domaine",
"badEncoding": "Mauvais encodage", "badEncoding": "Mauvais encodage",
"badExpression": "Mauvaise expression", "badExpression": "Mauvaise expression",
@ -585,6 +586,7 @@
"twitterParams": "Paramètres Twitter", "twitterParams": "Paramètres Twitter",
"twitterSecret": "Secret de l'API", "twitterSecret": "Secret de l'API",
"uid": "Identifiant", "uid": "Identifiant",
"unknownAttrOrMacro": "Attribut ou macro inconnu",
"unknownError": "Erreur inconnue", "unknownError": "Erreur inconnue",
"unknownKey": "Clef inconnue", "unknownKey": "Clef inconnue",
"unsecuredCookie": "Cookie non sécurisé", "unsecuredCookie": "Cookie non sécurisé",