Bb-Collaborate-V3

 view release on metacpan or  search on metacpan

t/soap-connect.t  view on Meta::CPAN

#!perl
use warnings; use strict;
use Test::More tests => 18;
use Test::Fatal;

use lib '.';
use t::Bb::Collaborate::V3;

use Bb::Collaborate::V3;
# don't 'use' anything here! We're testing Elive's ability to load the
# other required classes (Elive::Connection, Elive::Entity::User etc)

our $t = Test::More->builder;

SKIP: {

    my %result = t::Bb::Collaborate::V3->test_connection(noload => 1);
    my $auth = $result{auth};

    skip ($result{reason} || 'skipping live tests', 18)
	unless $auth && @$auth;

    my $connection_class = $result{class};

    my $connection;

    if ($connection_class eq 'Bb::Collaborate::V3::Connection') {
	#
	# exercise a direct connection from Elive main. No preload
	# of connection or entity classes.
	#
        note("connecting: @$auth");
	
	is( exception {$connection = Bb::Collaborate::V3::Connection->connect(@$auth)} => undef,
	      "Bb::Collaborate::V3::Connection->connect(...) - lives");
    }
    else {
	eval "require $connection_class";
	die $@ if $@;

	note ("connecting: user=$auth->[1], url=$auth->[0]");

	is( exception {$connection = $connection_class->connect(@$auth)} => undef,
		       "${connection_class}->connect(...) - lives");
	Bb::Collaborate::V3->connection($connection);
    }

    ok($connection, 'got connection');

    BAIL_OUT("unable to connect - aborting further tests")
	unless $t->is_passing;

    isa_ok($connection, $connection_class,'connection')
	or exit(1);

    my $scheduling_manager;
    is ( exception {$scheduling_manager = $connection->scheduling_manager} => undef,
	      '$connection->scheduling_manager - lives');
    isa_ok($scheduling_manager, 'Bb::Collaborate::V3::SchedulingManager','scheduling_manager');
    my %min_version_nums = (ELM => '3.5.0', SAS => '7.2.0-935');
    my %max_version_nums = (ELM => '3.7.0', SAS => '7.7.0-205');

    ok(my $scheduler_version = $scheduling_manager->version, 'got server version');
    ok(my $scheduler_manager = $scheduling_manager->manager, 'got server manager');



( run in 1.104 second using v1.01-cache-2.11-cpan-54e63673c56 )