#!/usr/bin/perl

use strict;
use warnings;

use Apache::Test qw( -withtestmore );

plan tests => 4;

use lib qw( ./t ./lib );

use PS::IPP::IData::Client;
use PS::IPP::IData::Util qw( :standard );
use Test::IData;

my $hostport = Apache::Test->config->{ 'hostport' };

Test::IData->setup;

{
    my $idata = PS::IPP::IData::Client->new(
        proxy => "http://$hostport/idata",
    );

    isa_ok( $idata, "PS::IPP::IData::Client" );
}

Test::IData->setup;

{
    my $idata = PS::IPP::IData::Client->new(
        proxy => "http://$hostport/idata",
        uri   => "http://example.com/PS/IPP/IData/Client",
    );

    isa_ok( $idata, "PS::IPP::IData::Client" );
}

Test::IData->setup;

eval {
    PS::IPP::IData::Client->new;
};
like( $@, qr/Mandatory parameter/, "no proxy" );

Test::IData->setup;

eval {
    PS::IPP::IData::Client->new(
        proxy => "foo",
        dog => "do"
    );
};
like( $@, qr/not listed in the validation options/, "bad param" );

Test::IData->cleanup;
