Title: [opsview] [9848] remove obsolete test
- Revision
- 9848
- Author
- aburzynski
- Date
- 2012-08-15 16:48:46 +0100 (Wed, 15 Aug 2012)
Log Message
remove obsolete test
Removed Paths
Deleted: trunk/opsview-web/t/652-api2-tests.t
===================================================================
--- trunk/opsview-web/t/652-api2-tests.t 2012-08-15 15:46:10 UTC (rev 9847)
+++ trunk/opsview-web/t/652-api2-tests.t 2012-08-15 15:48:46 UTC (rev 9848)
@@ -1,104 +0,0 @@
-#!/usr/bin/perl
-# Test rest
-
-use warnings;
-use strict;
-use FindBin qw($Bin);
-use lib "$Bin/../lib";
-
-use lib "/usr/local/nagios/lib", "/usr/local/nagios/etc",
- "/usr/local/nagios/t/lib";
-
-use Test::More qw(no_plan);
-use Test::Deep;
-use Test::LongString;
-
-use Opsview::Test qw(opsview runtime);
-
-#use Test::WWW::Mechanize::Catalyst qw(Opsview::Web);
-use HTTP::Request::Common;
-use Test::WWW::Mechanize;
-use JSON;
-
-use lib "$Bin/lib";
-use Opsview::TestUtils;
-
-use Data::Dump qw(dump);
-
-my $json = JSON->new->relaxed(1);
-
-my $content;
-
-#my $ua = Test::WWW::Mechanize::Catalyst->new( stack_depth => 0 );
-my $ua = Test::WWW::Mechanize->new( stack_depth => 0 );
-
-rest_log_in( $ua, "admin", "initial" );
-$ua->add_header( 'content-type' => 'application/json' );
-
-my $url_prefix = "http://localhost:3000";
-
-my $testcase_dir = "$Bin/var/api";
-
-my @tests_to_run = ();
-
-@tests_to_run = @ARGV;
-if ( @tests_to_run && $tests_to_run[0] eq "nodb" ) {
- shift @tests_to_run;
-}
-
-if (@tests_to_run) {
- @tests_to_run = map { s%.*\/%%; $_ } @tests_to_run;
-}
-else {
- opendir TESTS, $testcase_dir or die "Can't open $testcase_dir";
- foreach my $file ( sort readdir TESTS ) {
- next unless $file =~ /\.testcase$/;
- push @tests_to_run, $file;
- }
- closedir TESTS;
-}
-
-foreach my $file (@tests_to_run) {
- run_test( "$testcase_dir/$file" );
-}
-
-sub run_test {
- my $testfile = shift;
- open F, $testfile or die "Cannot open: $testfile";
- diag("Testfile: $testfile") if ( $ENV{TEST_VERBOSE} );
- my $line = <F>;
- my ( $method, $URL ) = ( $line =~ /(\w+) (.*)/ );
-
- my $content;
- while ( $line = <F> ) {
- chomp $line;
- last if ( $line eq "ENDCONTENT" );
- $content .= $line;
- }
-
- my $req = HTTP::Request->new(
- $method => "$url_prefix$URL",
- HTTP::Headers->new( "Content-type" => "application/json" ),
- );
- $req->content($content) if $content;
-
- $ua->request($req);
- is( $ua->status, 200, "$method $url_prefix$URL" ) || diag( $ua->content );
-
- my $got = $json->decode( $ua->content );
-
- my $expected_response;
- while ( $line = <F> ) {
- $expected_response .= $line;
- }
-
- my $expected;
- eval { $expected = $json->decode($expected_response); };
- if ($@) {
- die(
- "Bad expected json file - did you dump in perl mode?\nDetails: $@"
- );
- }
- is_deeply( $got, $expected, "JSON returns same ($testfile)" )
- || diag( Data::Dump::dump($got) );
-}
_______________________________________________
Opsview-checkins mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-checkins