lemonldap-ng/lemonldap-ng-portal/t
2018-11-29 21:36:54 +01:00
..
sessions SAML in progress (#595) 2016-11-22 20:55:10 +00:00
sessions2 Rename _loginHistory (#1169) 2017-03-21 21:00:37 +00:00
testslapd Avoid double LDAP entry 2018-05-29 22:53:14 +02:00
01-AuthDemo.t make tidy 2018-11-26 14:40:21 +01:00
01-pdata.t Escape pdata cookie value (#1461) 2018-07-05 21:22:47 +02:00
02-Password-Demo.t make tidy 2018-11-26 14:40:21 +01:00
03-XSS-protection.t Clean tests (not finished) (#595)' 2016-12-23 06:41:03 +00:00
19-Auth-Null.t Add REST Auth/UserDB/Password backend (closes: #1174) 2017-02-23 21:46:00 +00:00
20-Auth-and-password-DBI-dynamic-hash.t Fix little warnings (#1559) 2018-11-29 17:00:28 +01:00
20-Auth-and-password-DBI.t Use "$maintests" everywhere 2018-02-08 21:55:21 +01:00
20-Auth-DBI-utf8.t Use "$maintests" everywhere 2018-02-08 21:55:21 +01:00
21-Auth-and-password-LDAP.t Use "$maintests" everywhere 2018-02-08 21:55:21 +01:00
21-Auth-LDAP-utf8.t Use "$maintests" everywhere 2018-02-08 21:55:21 +01:00
22-Auth-and-password-AD.t Add AD password module (#1530) 2018-10-29 18:35:25 +01:00
23-Auth-and-password-REST.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
24-AuthApache.t Finish cleaning tests (#595) 2016-12-23 10:02:21 +00:00
24-AuthKerberos.t Don't reload portal if conf is already loaded 2018-06-05 23:13:18 +02:00
25-AuthSlave.t Create a "Same" value for userDB and remove some other 2017-02-05 09:13:20 +00:00
26-AuthRemote.t Create a "Same" value for userDB and remove some other 2017-02-05 09:13:20 +00:00
27-AuthProxy.t Use "$maintests" everywhere 2018-02-08 21:55:21 +01:00
28-AuthChoice-and-password.t Improve test (#1517) 2018-10-09 22:45:40 +02:00
28-AuthChoice-with-rules.t Fix some warnings 2018-11-29 21:19:39 +01:00
29-AuthSSL.t Don't reload portal if conf is already loaded 2018-06-05 23:13:18 +02:00
30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO-IdP-initiated.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
30-Auth-and-issuer-SAML-Metadata.t Replace lmLog by logger-> (#857) 2017-02-15 06:41:50 +00:00
30-Auth-and-issuer-SAML-POST-IdP-initiated.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
30-Auth-and-issuer-SAML-POST.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
30-Auth-and-issuer-SAML-Redirect-IdP-initiated.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
30-Auth-and-issuer-SAML-Redirect.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
30-Auth-SAML-with-choice.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
30-CDC.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
30-SAML-Head-to-Tail-POST.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
30-SAML-ReAuth-with-choice.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
30-SAML-ReAuth.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
30-SAML-SP-rule.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
31-Auth-and-issuer-CAS-declared-app.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
31-Auth-and-issuer-CAS-default.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
31-Auth-and-issuer-CAS-gateway.t No more pdata in CAS gateway mode test (#1528) 2018-10-29 08:09:03 +01:00
31-Auth-and-issuer-CAS-proxied.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
31-Auth-and-issuer-CAS-with-choice-and-cancel.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
31-Auth-and-issuer-CAS-with-choice.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
32-Auth-and-issuer-OIDC-authorization_code-OP-logout.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
32-Auth-and-issuer-OIDC-authorization_code-with-authchoice.t Missings unlink 2018-10-03 22:01:32 +02:00
32-Auth-and-issuer-OIDC-authorization_code.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
32-Auth-and-issuer-OIDC-hybrid.t Fix unit test 2018-11-20 22:49:51 +01:00
32-Auth-and-issuer-OIDC-implicit.t Fix warnings in RPM build (#1559) 2018-11-29 21:36:54 +01:00
32-OIDC-RP-rule.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
33-Auth-and-issuer-OpenID2.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
34-Auth-Proxy-and-REST-Server.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
34-Auth-Proxy-and-SOAP-Server.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
35-My-session.t Verify "mysession" (#970) 2017-03-06 16:43:06 +00:00
35-REST-config-backend.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
35-REST-sessions-with-REST-server.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
35-SOAP-config-backend.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
35-SOAP-sessions-with-SOAP-server.t Provide WSDL in 2.0 (#8) 2018-09-26 07:28:29 +02:00
36-Combination-Kerberos-or-Demo.t Tidy 2018-03-13 07:14:01 +01:00
36-Combination-with-over.t Use "$maintests" everywhere 2018-02-08 21:55:21 +01:00
36-Combination-with-token.t Don't reload portal if conf is already loaded 2018-06-05 23:13:18 +02:00
36-Combination.t Don't reload portal if conf is already loaded 2018-06-05 23:13:18 +02:00
37-CAS-App-to-SAML-IdP-POST.t Fix warnings in RPM build (#1559) 2018-11-29 21:36:54 +01:00
37-Logout-from-OIDC-RP-to-SAML-SP.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
37-OIDC-RP-to-SAML-IdP-GET.t Fix warnings in RPM build (#1559) 2018-11-29 21:36:54 +01:00
37-OIDC-RP-to-SAML-IdP-POST.t Fix warnings in RPM build (#1559) 2018-11-29 21:36:54 +01:00
37-SAML-SP-GET-to-OIDC-OP.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
37-SAML-SP-POST-to-CAS-server-with-Choice.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
37-SAML-SP-POST-to-CAS-server.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
37-SAML-SP-POST-to-OIDC-OP.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
40-Notifications-JSON-DBI.t make tidy 2018-11-26 14:40:21 +01:00
40-Notifications-JSON-File-with-token.t make tidy 2018-11-26 14:40:21 +01:00
40-Notifications-JSON-File.t make tidy 2018-11-26 14:40:21 +01:00
40-Notifications-JSON-Server.t Fix warnings in RPM build (#1559) 2018-11-29 21:36:54 +01:00
40-Notifications-XML-DBI.t Use "$maintests" everywhere 2018-02-08 21:55:21 +01:00
40-Notifications-XML-File.t make tidy 2018-11-26 14:40:21 +01:00
40-Notifications-XML-Server.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
41-Captcha.t make tidy 2018-11-26 14:40:21 +01:00
41-Token.t Replace lmLog by logger-> (#857) 2017-02-15 06:41:50 +00:00
42-Register-Demo-with-captcha.t make tidy 2018-11-26 14:40:21 +01:00
42-Register-Demo-with-token.t Don't depend on Email::Sender for tests 2017-04-13 20:08:55 +00:00
42-Register-Demo.t Fix UTF-8 problems in mail 2017-12-15 16:47:58 +01:00
42-Register-LDAP.t Tidy 2018-03-13 07:14:01 +01:00
43-MailReset-Choice.t Password::Choice wasn't called (#1508 #1517) 2018-11-16 15:08:27 +01:00
43-MailReset-DBI.t make tidy 2018-11-26 14:40:21 +01:00
43-MailReset-LDAP.t Typo 2018-11-15 21:16:58 +01:00
43-MailReset-with-captcha.t make tidy 2018-11-26 14:40:21 +01:00
43-MailReset-with-token.t make tidy 2018-11-26 14:40:21 +01:00
43-MailReset.t make tidy 2018-11-26 14:40:21 +01:00
50-IssuerGet.t make tidy 2016-12-26 09:23:35 +00:00
60-Status.t Normalize test names (#595) 2017-03-06 15:56:47 +00:00
61-BruteForceProtection.t make tidy 2018-10-12 10:04:03 +02:00
61-ForceAuthn.t Improve unit test 2018-11-26 21:59:40 +01:00
61-GrantSession.t make tidy 2018-11-26 14:40:21 +01:00
61-Session-ActivityTimeout.t make tidy 2018-11-26 14:40:21 +01:00
61-Session-Timeout.t make tidy 2018-11-26 14:40:21 +01:00
62-SingleSession.t Normalize test names (#595) 2017-03-06 15:56:47 +00:00
63-History.t make tidy 2018-11-26 14:40:21 +01:00
64-StayConnected.t Add StayConnected test (#1131) 2017-03-08 20:56:49 +00:00
65-AutoSignin.t AutoSignin isn't a auth module (#1318) 2017-10-27 13:53:15 +00:00
66-CDA-already-auth.t Tidy 2018-06-21 21:35:16 +02:00
66-CDA-with-REST.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
66-CDA-with-SOAP.t Improve Debian autopkgtest tests 2018-09-05 22:24:23 +02:00
66-CDA.t Tidy 2018-06-21 21:35:16 +02:00
70-2F-TOTP_8.t make tidy 2018-09-02 17:31:58 +02:00
70-2F-TOTP-with-HISTORY.t Update unit tests with history 2018-09-09 23:37:40 +02:00
70-2F-TOTP.t make tidy 2018-11-26 14:40:21 +01:00
71-2F-U2F-with-HISTORY.t Update unit tests with history 2018-09-09 23:37:40 +02:00
71-2F-U2F.t Improve unit test 2018-11-26 21:38:59 +01:00
72-2F-REST-with-HISTORY.t make tidy 2018-11-26 14:40:21 +01:00
73-2F-UTOTP-TOTP-and-U2F-with-HISTORY.t Update unit tests with history 2018-09-09 23:37:40 +02:00
73-2F-UTOTP-TOTP-and-U2F.t make tidy 2018-11-26 14:40:21 +01:00
73-2F-UTOTP-TOTP-only-with-HISTORY.t Update unit tests with history 2018-09-09 23:37:40 +02:00
73-2F-UTOTP-TOTP-only.t Fix typo 2018-06-13 21:51:01 +02:00
74-2F-Required.t Add sfRequired test (#1487) 2018-08-15 22:28:09 +02:00
75-2F-Registers.t make tidy 2018-11-26 14:40:21 +01:00
76-2F-Ext-with-BruteForce.t make tidy 2018-10-12 10:04:03 +02:00
76-2F-Ext-with-GrantSession.t make tidy 2018-10-12 10:04:03 +02:00
76-2F-Ext-with-HISTORY.t Improve unit test 2018-11-26 21:59:40 +01:00
90-Translations.t Normalize test names (#595) 2017-03-06 15:56:47 +00:00
99-pod.t Reorganize files - work in progress (#444) 2012-02-28 22:52:36 +00:00
lmConf-1.json Remove workaround in tests (#1247) (4349686c) 2018-06-12 22:40:27 +02:00
pdata.pm make tidy 2018-07-05 23:00:40 +02:00
README.md Add test framework doc 2018-09-06 11:23:49 +02:00
saml-lib.pm Group SAML tests (#595) 2017-03-15 06:29:44 +00:00
sendOTP.pl make tidy 2018-10-12 10:04:03 +02:00
smtp.pm Replace MIME::Lite by Email::Sender/MIME::Entity (#1206) 2017-03-27 05:22:08 +00:00
test-ldap.pm Clean repo 2017-03-03 17:25:03 +00:00
test-lib.pm spelling errors 2018-11-26 14:41:48 +01:00
test-psgi.pm make tidy 2018-11-26 14:40:21 +01:00
vrfyOTP.pl make tidy 2018-10-12 10:04:03 +02:00

NAME

test-lib.pm - Test framework for LLNG portal

SYNOPSIS

use Test::More;
use strict;
use IO::String;

require 't/test-lib.pm';

my $res;

my $client = LLNG::Manager::Test->new( {
    ini => {
        logLevel => 'error',
        #...
    }
  }
);

ok(
    $res = $client->_post(
        '/',
        IO::String->new('user=dwho&password=dwho'),
        length => 23
    ),
    'Auth query'
);
count(1);
expectOK($res);
my $id = expectCookie($res);

clean_sessions();
done_testing( count() );

DESCRIPTION

This test library permits to simulate browser navigation.

Functions

In these functions, $res is the result of a LLNG::Manager::Test::_get() or LLNG::Manager::Test::_post() call (see below).

count($inc)

Returns number of tests done. Increment test number if an argument is given

explain( $result, $expected_result )

Used to display error if test fails:

ok( $res->[0] == 302, 'Get redirection' ) or
  explain( $res->[0], 302 );

clean_sessions()

Clean sessions created during tests

expectRedirection( $res, $location )

Verify that request result is a redirection to $location. $location can be:

  • a string: location must match exactly

  • a regexp: location must match this regexp. In this case, the list of matching strings are returned. Example:

      my( $uri, $query ) = expectRedirection( $res, qr#http://host(/[^\?]*)?(.*)$# );
    

expectAutoPost(@args)

Same behaviour as expectForm() but verify also that form method is post.

TODO: verify javascript

expectForm( $res, $hostRe, $uriRe, @requiredFields )

Verify form in HTML result and return ( $host, $uri, $query, $method ):

  • verify that a GET/POST form exists
  • if a $hostRe regexp is given, verify that form target matches and populates $host. Skipped if $hostRe eq "#"
  • if a $uriRe regexp is given, verify that form target matches and populates $uri
  • if @requiredFields exists, verify that each element is an input name
  • build form-url-encoded string looking at parameters/values and store it in $query

expectAuthenticatedAs($user)

Verify that result has a Lm-Remote-User header and value is $user

expectOK($res)

Verify that returned code is 200

expectBadRequest($res)

Verify that returned code is 400. Note that it works only for Ajax request (see below).

expectReject( $res, $code )

Verify that returned code is 401 and JSON result contains error:"$code". Note that it works only for Ajax request (see below).

expectCookie( $res, $cookieName )

Check if a Set-Cookie exists and set a cookie named $cookieName. Return its value.

exceptCspFormOK( $res, $host )

Verify that Content-Security-Policy header allows to connect to $host.

getCookies($res)

Returns an hash ref with names => values of cookies set by server.

getHeader( $res, $hname )

Returns value of first header named $hname in $res response.

getRedirection($res)

Returns value of Location header.

getUser($res)

Returns value of Lm-Remote-User header.

LLNG::Manager::Test Class

Accessors

  • app: built application
  • class: class to test (default Lemonldap::NG::Portal::Main)
  • p: portal object
  • ini: initialization parameters ($defaultIni values + given parameters)

Methods

logout($id)

Launch a /?logout=1 request an test:

  • if response is 200
  • if cookie 'lemonldap' and 'lemonldappdata' have no value
  • if a GET request with previous cookie value ($i) is rejected

_get( $path, %args )

Simulates a GET requests to $path. Accepted arguments:

  • accept: accepted content, default to Ajax request. Use 'text/html' to test content (to launch a expectForm() for example).
  • cookie: full cookie string
  • custom: additional headers (hash ref only)
  • ip: remote address. Default to 127.0.0.1
  • method: default to GET. Only GET/DELETE values are acceptable (use _post() if you want to launch a POST/PUT request)
  • query: query string
  • referer
  • remote_user: REMOTE_USER header value

_post( $path, $body, %args )

Same as _get except that a body is required. $body must be a file handle. Example with IO::String:

ok( 
    $res = $client->_post(
        '/',
        IO::String->new('user=dwho&password=dwho'),
        length => 23
    ),
    'Auth query'
);

_delete( $path, %args )

Call _get() with method set to DELETE.

_put( $path, $body, %args )

Call _post() with method set to PUT