#!/usr/bin/perl
#
# Written by Roland Schemers
# Copyright 2003, 2013
#     The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.

use strict;
use warnings;

use WebAuth::Tests qw(build_page run_test);

# Text for the page.
my @extended = ('This test is to make sure query parameters work at the '
                .'initial redirect.');

# Set information for the tests.
my %settings = (
    test_number   => 6,
    test_desc     => 'testing query params on initial redirect',
    extended_desc => \@extended,
    extra_title   => 'Performing Query String test',
    extra_tests   => query_string_test(),
);

print "Content-type: text/html\n\n";
print build_page(\%settings);

#############################################################################
# Tests only for this page
#############################################################################

# Run test to see if query string is correctly set.
sub query_string_test {
    my @tests;
    my $query_string = $ENV{QUERY_STRING};
    my $record = run_test('QUERY_STRING',
                          $query_string eq 'x=1&y=2',
                          $query_string,
                          "incorrect value: $query_string",
                          1);
    push (@tests, $record);
    return \@tests;
}
