summaryrefslogtreecommitdiffstats
path: root/tests/FTPTest.pm
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 03:06:57 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 03:06:57 +0000
commita3eed2c248067f0319cb72bcc8b5e2c7054ea6dc (patch)
treefd79d650c7ffee81608955be5f4fd8edd791834e /tests/FTPTest.pm
parentInitial commit. (diff)
downloadwget-a3eed2c248067f0319cb72bcc8b5e2c7054ea6dc.tar.xz
wget-a3eed2c248067f0319cb72bcc8b5e2c7054ea6dc.zip
Adding upstream version 1.20.1.upstream/1.20.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/FTPTest.pm')
-rw-r--r--tests/FTPTest.pm62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/FTPTest.pm b/tests/FTPTest.pm
new file mode 100644
index 0000000..0a1c768
--- /dev/null
+++ b/tests/FTPTest.pm
@@ -0,0 +1,62 @@
+package FTPTest;
+
+use strict;
+use warnings;
+
+use FTPServer;
+use WgetTests;
+
+our @ISA = qw(WgetTest);
+my $VERSION = 0.01;
+
+{
+ my %_attr_data = ( # DEFAULT
+ );
+
+ sub _default_for
+ {
+ my ($self, $attr) = @_;
+ return $_attr_data{$attr} if exists $_attr_data{$attr};
+ return $self->SUPER::_default_for($attr);
+ }
+
+ sub _standard_keys
+ {
+ my ($self) = @_;
+ ($self->SUPER::_standard_keys(), keys %_attr_data);
+ }
+}
+
+sub _setup_server
+{
+ my $self = shift;
+
+ $self->{_server} = FTPServer->new(
+ input => $self->{_input},
+ server_behavior => $self->{_server_behavior},
+ LocalAddr => 'localhost',
+ ReuseAddr => 1,
+ rootDir => "$self->{_workdir}/$self->{_name}/input"
+ )
+ or die "Cannot create server!!!";
+}
+
+sub _launch_server
+{
+ my $self = shift;
+ my $synch_func = shift;
+
+ $self->{_server}->run($synch_func);
+}
+
+sub _substitute_port
+{
+ my $self = shift;
+ my $ret = shift;
+ $ret =~ s/\Q{{port}}/$self->{_server}->sockport/eg;
+ return $ret;
+}
+
+1;
+
+# vim: et ts=4 sw=4