]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/lei-mirror.t
treewide: update to v3 Tor onions
[public-inbox.git] / t / lei-mirror.t
index 9769f31bdc3fe1efd8d2566fe5deefd0e5d9b163..dfd35e1af5cae6a1866b64ae24d1c35d32c33575 100644 (file)
@@ -2,8 +2,7 @@
 # Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict; use v5.10.1; use PublicInbox::TestCommon;
-require_git 2.6;
-require_mods(qw(DBD::SQLite Search::Xapian));
+require_mods(qw(-httpd lei));
 my $sock = tcp_server();
 my ($tmpdir, $for_destroy) = tmpdir();
 my $http = 'http://'.tcp_host_port($sock);
@@ -41,6 +40,24 @@ test_lei({ tmpdir => $tmpdir }, sub {
        ok(!-d "$t2-fail", 'destination not created on failure');
        lei_ok('ls-external');
        unlike($lei_out, qr!\Q$t2-fail\E!, 'not added to ls-external');
+
+       my %phail = (
+               HTTPS => 'https://public-inbox.org/' . 'phail',
+               ONION => 'http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/' . 'phail,'
+       );
+       for my $t (qw(HTTPS ONION)) {
+       SKIP: {
+               my $k = "TEST_LEI_EXTERNAL_$t";
+               $ENV{$k} or skip "$k unset", 1;
+               my $url = $phail{$t};
+               my $dir = "phail-$t";
+               ok(!lei(qw(add-external -Lmedium --mirror),
+                       $url, $dir), '--mirror non-existent v2');
+               is($? >> 8, 22, 'curl 404');
+               ok(!-d $dir, 'directory not created');
+               unlike($lei_err, qr/# mirrored/, 'no success message');
+       } # SKIP
+       } # for
 });
 
 ok($td->kill, 'killed -httpd');