AnyEvent-FTP

 view release on metacpan or  search on metacpan

t/anyevent_ftp_server_context_memory__cdup.t  view on Meta::CPAN

use Test2::V0 -no_srand => 1;
use autodie;
use Test::AnyEventFTPServer;
use Path::Class::Dir;
use AnyEvent::FTP::Server::Context::Memory;

AnyEvent::FTP::Server::Context::Memory->store->{top} = {
  foo => { bar => { stuff => { things => '' }} },
  bar => {},
  baz => 'stuff',
};

my $t = create_ftpserver_ok('Memory');

my $context;
$t->on_connect(sub { $context = shift->context });

# force a connect
$t->command_ok('NOOP')
  ->code_is(200);

is $context->cwd, "/", "cwd = /";

$t->command_ok('CDUP')
  ->code_is(250);

is $context->cwd, "/", "cwd = /";

$context->cwd(Path::Class::Dir->new_foreign('Unix', '/top/foo/bar/stuff'));

$t->command_ok('CDUP')
  ->code_is(250);

is $context->cwd, "/top/foo/bar", "cwd = /top/foo/bar";

$context->cwd(Path::Class::Dir->new_foreign('Unix', '/bogus/directory'));

$t->command_ok('CDUP')
  ->code_is(550);

done_testing;



( run in 1.925 second using v1.01-cache-2.11-cpan-98e64b0badf )