spelling
[bioperl-run.git] / t / AnalysisFactory_soap.t
bloba028efa49ece272bfcfe531427d2020e54a3bd6b
1 # -*-Perl-*-
2 # $id$
3 ## Bioperl Test Harness Script for Modules
5 use strict;
7 BEGIN {
8     use Bio::Root::Test;
10     test_begin(-tests => 13,
11                            -requires_networking => 1);
12     use_ok('Bio::Tools::Run::AnalysisFactory');
16 # setup global objects that are to be used in more than one test
17 # Also test they were initialised correctly
18 # test new with default access
19 my $factory = Bio::Tools::Run::AnalysisFactory->new();
20 isa_ok( $factory, 'Bio::Tools::Run::AnalysisFactory');
22 # test new with explicit access
23 $factory = Bio::Tools::Run::AnalysisFactory->new(-access=>'soap');
24 isa_ok( $factory, 'Bio::Tools::Run::AnalysisFactory');
26 # test new with non-existing access
27 throws_ok { Bio::Tools::Run::AnalysisFactory->new(-access=>'non_existing') } qr/cannot be found or loaded/, 'Non existant access method threw an error';
29 # test default factory values
31 # Now onto the nitty gritty tests of the modules methods
32 SKIP: {
33     test_skip(-tests => 9, -requires_module => 'SOAP::Lite');
34         use_ok('SOAP::Lite');
35         
36         my $array_ref = $factory->available_categories;
37         isa_ok( $array_ref, 'ARRAY' );
38         ok( grep(/protein/i, @$array_ref), 'available_categories returned category with protein' );
39         
40         $array_ref = $factory->available_analyses;
41         isa_ok( $array_ref, 'ARRAY' );
42         ok( grep(/seqret/i, @$array_ref), 'available_analyses returned category with seqret' );
43         
44         $array_ref = $factory->available_analyses('edit');
45         isa_ok( $array_ref, 'ARRAY' );
46         ok( grep(/seqret/i, @$array_ref), 'available_analyses("edit") returned something' );
47         
48         my $service;
49         lives_ok {$service = $factory->create_analysis('edit.seqret')};
50         skip ("create_analysis failed :$@", 1) if $@;
51         isa_ok( $service, 'Bio::Tools::Run::Analysis::soap' );