GDPR-IAB-TCFv2

 view release on metacpan or  search on metacpan

t/14-cmp-validator.t  view on Meta::CPAN

  }
  qr/Failed to fetch CMP list.*Connection refused/, "failed response surfaces the reason text";
};

subtest "CMPValidator: env_proxy is honored on the default client" => sub {

  # Proves the default HTTP::Tiny is constructed with env_proxy => 1
  # by setting an unreachable proxy and asserting the failure mentions
  # it. Skip if the surrounding environment already has a real proxy
  # configured -- we don't want to disturb the user's shell.
  plan skip_all => "http_proxy already set in env" if $ENV{http_proxy} || $ENV{HTTP_PROXY};
  plan skip_all => "HTTP::Tiny not installed" unless eval { require HTTP::Tiny; 1 };

  local $ENV{http_proxy} = 'http://127.0.0.1:1';

  throws_ok {
    GDPR::IAB::TCFv2::CMPValidator->new(url => 'http://example.invalid/cmp.json', network_ok => 1, timeout => 2,);
  }
  qr/Failed to fetch CMP list/, "fetch fails with the unreachable proxy in env (env_proxy was applied)";
};



( run in 0.699 second using v1.01-cache-2.11-cpan-71847e10f99 )