Commit 51038f76 authored by Christophe Maudoux's avatar Christophe Maudoux

Append unit test (#1661)

parent b76db500
# Test viewer API
use Test::More;
use strict;
use IO::String;
use JSON qw(from_json);
require 't/test-lib.pm';
# Test that key value is sent
my $res = &client->jsonResponse('/view/1/portalDisplayOidcConsents');
ok( $res->{value} eq '$_oidcConnectedRP', 'Key found' );
count(1);
# Test that hidden key values are NOT sent
$res = &client->jsonResponse('/view/1/portalDisplayLogout');
ok( $res->{value} eq '_Hidden_', 'Key is hidden' );
$res = &client->jsonResponse('/view/1/samlIDPMetaDataNodes');
ok( $res->{value} eq '_Hidden_', 'Key is hidden' );
count(2);
# Try to display latest conf
$res = &client->jsonResponse('/view/latest');
ok( $res->{cfgNum} eq '1', 'Browser is allowed' );
count(1);
# Load lemonldap-ng-noBrowser.ini
use_ok('Lemonldap::NG::Manager::Cli::Lib');
my $client2;
ok(
$client2 = Lemonldap::NG::Manager::Cli::Lib->new(
iniFile => 't/lemonldap-ng-noBrowser.ini'
),
'Client object'
);
# Try to display latest conf
$res = $client2->jsonResponse('/view/1');
ok( $res->{value} eq '_Hidden_', 'Browser is NOT allowed' );
count(3);
done_testing( count() );
[all]
logLevel = error
localSessionStorage =
localSessionStorageOptions =
[configuration]
type=File
dirName=t/conf
[portal]
checkXSS = 0
[handler]
https = 0
;port = 8080
status = 0
useRedirectOnError = 0
[manager]
protection = manager
staticPrefix = app/
languages = fr, en, vi, ar
templateDir = site/templates/
enabledModules = conf, sessions, notifications, 2ndFA, viewer
viewerHiddenPK = samlIDPMetaDataNodes samlSPMetaDataNodes portalDisplayLogout
viewerAllowBrowser = 0
[sessionsExplorer]
;protection = authenticate
[apply]
......@@ -26,6 +26,9 @@ protection = manager
staticPrefix = app/
languages = fr, en, vi, ar
templateDir = site/templates/
enabledModules = conf, sessions, notifications, 2ndFA, viewer
viewerHiddenPK = samlIDPMetaDataNodes samlSPMetaDataNodes portalDisplayLogout
viewerAllowBrowser = 1
[sessionsExplorer]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment