Description: Disable tests requiring network access (Mojolicious)
Forwarded: not-needed
Author: Nick Morrott <nickm@debian.org>
Reviewed-by: gregor herrmann <gregoa@debian.org>
Last-Update: 2020-01-29

--- a/t/authenticate.t
+++ b/t/authenticate.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 my $auth = app->routes->under('/api')->to(
   cb => sub {
--- a/t/autorender.t
+++ b/t/autorender.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 my %inline;
 
 {
--- a/t/coerce.t
+++ b/t/coerce.t
@@ -3,6 +3,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 my $coerced = t();
 $coerced->get_ok('/api/user')->status_is(200)->json_is('/age', 34);
 
--- a/t/collectionformat.t
+++ b/t/collectionformat.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 
 get '/pets' => sub {
--- a/t/correct-order-of-paths.t
+++ b/t/correct-order-of-paths.t
@@ -3,6 +3,8 @@
 use Test::More;
 use Mojo::Util 'encode';
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 
 post '/decode' => sub {
--- a/t/cors.t
+++ b/t/cors.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 our $cors_callback = 'main::cors_exchange';
 our $cors_method   = 'cors_exchange';
 
--- a/t/custom-format.t
+++ b/t/custom-format.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 my $what_ever;
 get '/cf' => sub {
--- a/t/default-value.t
+++ b/t/default-value.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 #============================================================================
 package MyApp;
 use Mojo::Base 'Mojolicious';
--- a/t/discriminator.t
+++ b/t/discriminator.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 
 post '/pets' => sub {
--- a/t/empty-string.t
+++ b/t/empty-string.t
@@ -3,6 +3,8 @@
 use Test::More;
 use Mojolicious::Lite;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 my $t = Test::Mojo->new;
 my ($res, $status);
 
--- a/t/error-messages.t
+++ b/t/error-messages.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 
 make_app();
--- a/t/example-array-of-hashes.t
+++ b/t/example-array-of-hashes.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 post '/echo' => sub {
   my $c = shift->openapi->valid_input or return;
--- a/t/headers.t
+++ b/t/headers.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 my $what_ever;
 get '/headers' => sub {
--- a/t/invalid-json.t
+++ b/t/invalid-json.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 post '/invalid' => sub {
   my $c = shift->openapi->valid_input or return;
--- a/t/issue-48-refs.t
+++ b/t/issue-48-refs.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 
 post '/event/update' => sub {
--- a/t/load-and-validate-spec.t
+++ b/t/load-and-validate-spec.t
@@ -2,6 +2,8 @@
 use Test::More;
 use JSON::Validator::OpenAPI::Mojolicious;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 my $validator = JSON::Validator::OpenAPI::Mojolicious->new;
 
 is $validator->load_and_validate_schema('data://main/echo.json'), $validator,
--- a/t/path-parameters.t
+++ b/t/path-parameters.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 
 post '/user/:id' => sub {
--- a/t/recursion.t
+++ b/t/recursion.t
@@ -1,6 +1,9 @@
 use Mojo::Base -strict;
 use Test::Mojo;
 use Test::More;
+
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use JSON::Validator 'validate_json';
 use JSON::Validator::OpenAPI::Mojolicious;
 
--- a/t/ref-param.t
+++ b/t/ref-param.t
@@ -3,6 +3,8 @@
 use Test::More;
 use Mojolicious::Lite;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 get '/test' => sub {
   my $c = shift->openapi->valid_input or return;
   my $params = $c->validation->output;
--- a/t/register.t
+++ b/t/register.t
@@ -3,6 +3,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 get(
   '/no-default-options/:id' => sub { $_[0]->render(openapi => {id => $_[0]->stash('id')}) },
--- a/t/renderer.t
+++ b/t/renderer.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 
 my $age = 43;
--- a/t/reply-spec.t
+++ b/t/reply-spec.t
@@ -3,6 +3,8 @@
 use Test::More;
 use Mojolicious;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 sub VERSION {1.42}
 
 {
--- a/t/route-names.t
+++ b/t/route-names.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 app->routes->namespaces(['MyApp::Controller']);
 get '/whatever' => sub { die 'Oh noes!' }, 'Whatever';
--- a/t/security-disabled.t
+++ b/t/security-disabled.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 post '/global' => sub {
   my $c = shift->openapi->valid_input or return;
--- a/t/set-request.t
+++ b/t/set-request.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 get '/echo' => sub {
   my $c = shift->openapi->valid_input or return;
--- a/t/spec.t
+++ b/t/spec.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 
 get '/spec' => sub {
--- a/t/swagger2.t
+++ b/t/swagger2.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 post '/echo' => sub {
   my ($c, $data, $cb) = @_;
--- a/t/tutorial.t
+++ b/t/tutorial.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 make_app();
 make_controller();
 
--- a/t/v2-file.t
+++ b/t/v2-file.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 post '/user' => sub {
   my $c = shift->openapi->valid_input or return;
--- a/t/v2-readonly.t
+++ b/t/v2-readonly.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 post '/user' => sub {
   my $c = shift->openapi->valid_input or return;
--- a/t/v3.t
+++ b/t/v3.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 
 get '/pets/:petId' => sub {
--- a/t/validate.t
+++ b/t/validate.t
@@ -2,6 +2,8 @@
 use Test::More;
 use Mojolicious::Lite;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 eval { plugin OpenAPI => {url => 'data://main/invalid.json'} };
 like $@, qr{Invalid.*Missing}si, 'missing spec elements';
 
--- a/t/x-mojo-placeholder.t
+++ b/t/x-mojo-placeholder.t
@@ -3,6 +3,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 my $t = Test::Mojo->new(make_app());
 
 monkey_patch 'Myapp::Controller::Pet' => one => sub {
--- a/t/yaml.t
+++ b/t/yaml.t
@@ -3,6 +3,8 @@
 use Test::More;
 use Mojolicious;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 my $n = 0;
 my %modules = ('YAML::XS' => '0.67');
 for my $module (keys %modules) {
--- a/t/bundle.t
+++ b/t/bundle.t
@@ -1,6 +1,9 @@
 use Mojo::Base -strict;
 use Mojo::File 'path';
 use Test::More;
+
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use JSON::Validator::OpenAPI::Mojolicious;
 
 # This test mimics what Mojolicious::Plugin::OpenAPI does when loading
--- a/t/issue-24-booleans-in-yaml-schema.t
+++ b/t/issue-24-booleans-in-yaml-schema.t
@@ -3,6 +3,8 @@
 use Test::More;
 use Mojo::JSON;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 eval {
   use Mojolicious::Lite;
   get('/whatever', sub { shift->render(openapi => {}) }, 'whatever');
--- a/t/load-from-app.t
+++ b/t/load-from-app.t
@@ -3,6 +3,8 @@
 use Mojolicious;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 my $validator = JSON::Validator::OpenAPI::Mojolicious->new;
 $validator->ua->server->app(Mojolicious->new);
 $validator->ua->server->app->routes->get(
--- a/t/v3-nullable.t
+++ b/t/v3-nullable.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 
 my %data = (id => 42);
--- a/t/v2-security.t
+++ b/t/v2-security.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 post '/global' => sub {
   my $c = shift->openapi->valid_input or return;
--- a/t/v3-body.t
+++ b/t/v3-body.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 post '/test' => sub {
   my $c = shift;
--- a/t/v3-security.t
+++ b/t/v3-security.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 
 post '/global' => sub {
--- a/t/tutorial_v3.t
+++ b/t/tutorial_v3.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 make_app();
 make_controller();
 
@@ -114,4 +116,4 @@
       "url": "/api"
     }
   ]
-}
\ No newline at end of file
+}
--- a/t/v3-default.t
+++ b/t/v3-default.t
@@ -3,6 +3,8 @@
 use Test::More;
 use Mojolicious::Lite;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 get '/test' => sub {
   my $c = shift->openapi->valid_input or return;
   $c->render(status => 200, openapi => $c->param('pcversion'));
--- a/t/v3-invalid_file_refs.t
+++ b/t/v3-invalid_file_refs.t
@@ -4,6 +4,8 @@
 use Mojolicious::Lite;
 use JSON::Validator::OpenAPI::Mojolicious;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 get '/test' => sub {
   my $c = shift->openapi->valid_input or return;
   $c->render(status => 200, openapi => $c->param('pcversion'));
--- a/t/v3-invalid_file_refs_no_path.t
+++ b/t/v3-invalid_file_refs_no_path.t
@@ -4,6 +4,8 @@
 use Mojolicious::Lite;
 use JSON::Validator::OpenAPI::Mojolicious;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 get '/test' => sub {
   my $c = shift->openapi->valid_input or return;
   $c->render(status => 200, openapi => $c->param('pcversion'));
--- a/t/v3-valid_file_refs.t
+++ b/t/v3-valid_file_refs.t
@@ -4,6 +4,8 @@
 use Mojolicious::Lite;
 use JSON::Validator::OpenAPI::Mojolicious;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 get '/test' => sub {
   my $c = shift->openapi->valid_input or return;
   $c->render(status => 200, openapi => $c->param('pcversion'));
--- a/t/v3-style-array.t
+++ b/t/v3-style-array.t
@@ -2,6 +2,8 @@
 use Test::Mojo;
 use Test::More;
 
+plan skip_all => "Unset NO_NETWORK to enable this test" if $ENV{NO_NETWORK};
+
 use Mojolicious::Lite;
 
 get '/pets' => sub {
