mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 06:55:59 +03:00
Fix perl tests #4722
* The dav auth realm is "sabre/dav" for newer server versions * Content checksums are enabled generally, so conflict detection is smarter
This commit is contained in:
parent
a36b4ec863
commit
e7f00339e6
3 changed files with 24 additions and 31 deletions
|
@ -85,6 +85,16 @@ sub fromFileName($)
|
|||
}
|
||||
}
|
||||
|
||||
sub setCredentials
|
||||
{
|
||||
my ($dav, $user, $passwd) = @_;
|
||||
|
||||
$dav->credentials(-url=> $owncloud, -realm=>"sabre/dav",
|
||||
-user=> $user, -pass=> $passwd);
|
||||
$dav->credentials(-url=> $owncloud, -realm=>"ownCloud",
|
||||
-user=> $user, -pass=> $passwd);
|
||||
}
|
||||
|
||||
|
||||
sub initTesting(;$)
|
||||
{
|
||||
|
@ -127,9 +137,7 @@ sub initTesting(;$)
|
|||
my $ua = HTTP::DAV::UserAgent->new(keep_alive => 1 );
|
||||
$d = HTTP::DAV->new(-useragent => $ua);
|
||||
|
||||
$d->credentials( -url=> $owncloud, -realm=>"ownCloud",
|
||||
-user=> $user,
|
||||
-pass=> $passwd );
|
||||
setCredentials($d, $user, $passwd);
|
||||
# $d->DebugLevel(3);
|
||||
$prefix = "t1" unless( defined $prefix );
|
||||
|
||||
|
@ -193,9 +201,7 @@ sub removeRemoteDir($;$)
|
|||
|
||||
my $url = testDirUrl() . $dir;
|
||||
if( $optionsRef && $optionsRef->{user} && $optionsRef->{passwd} ) {
|
||||
$d->credentials( -url=> $owncloud, -realm=>"ownCloud",
|
||||
-user=> $optionsRef->{user},
|
||||
-pass=> $optionsRef->{passwd} );
|
||||
setCredentials($d, $optionsRef->{user}, $optionsRef->{passwd});
|
||||
if( $optionsRef->{url} ) {
|
||||
$url = $optionsRef->{url} . $dir;
|
||||
}
|
||||
|
@ -219,9 +225,7 @@ sub createRemoteDir(;$$)
|
|||
my $url = testDirUrl() . $dir;
|
||||
|
||||
if( $optionsRef && $optionsRef->{user} && $optionsRef->{passwd} ) {
|
||||
$d->credentials( -url=> $owncloud, -realm=>"ownCloud",
|
||||
-user=> $optionsRef->{user},
|
||||
-pass=> $optionsRef->{passwd} );
|
||||
setCredentials($d, $optionsRef->{user}, $optionsRef->{passwd});
|
||||
if( $optionsRef->{url} ) {
|
||||
$url = $optionsRef->{url} . $dir;
|
||||
}
|
||||
|
@ -396,9 +400,7 @@ sub traverse( $$;$ )
|
|||
my %seen;
|
||||
|
||||
|
||||
$d->credentials( -url=> $owncloud, -realm=>"ownCloud",
|
||||
-user=> $user,
|
||||
-pass=> $passwd );
|
||||
setCredentials($d, $user, $passwd);
|
||||
$d->open( $owncloud );
|
||||
|
||||
if( my $r = $d->propfind( -url => $url, -depth => 1 ) ) {
|
||||
|
@ -513,9 +515,7 @@ sub put_to_dir( $$;$ )
|
|||
my $targetUrl = testDirUrl();
|
||||
|
||||
if( $optionsRef && $optionsRef->{user} && $optionsRef->{passwd} ) {
|
||||
$d->credentials( -url=> $owncloud, -realm=>"ownCloud",
|
||||
-user=> $optionsRef->{user},
|
||||
-pass=> $optionsRef->{passwd} );
|
||||
setCredentials($d, $optionsRef->{user}, $optionsRef->{passwd});
|
||||
if( $optionsRef->{url} ) {
|
||||
$targetUrl = $optionsRef->{url};
|
||||
}
|
||||
|
@ -649,9 +649,7 @@ sub moveRemoteFile($$;$)
|
|||
{
|
||||
my ($from, $to, $no_testdir) = @_;
|
||||
|
||||
$d->credentials( -url=> $owncloud, -realm=>"ownCloud",
|
||||
-user=> $user,
|
||||
-pass=> $passwd );
|
||||
setCredentials($d, $user, $passwd);
|
||||
|
||||
my $fromUrl = testDirUrl(). $from;
|
||||
my $toUrl = testDirUrl() . $to;
|
||||
|
@ -725,9 +723,7 @@ sub createShare($$)
|
|||
|
||||
my $dd = HTTP::DAV->new();
|
||||
|
||||
$dd->credentials( -url=> $owncloud, -realm=>"ownCloud",
|
||||
-user=> $share_user,
|
||||
-pass=> $share_passwd );
|
||||
setCredentials($dd, $share_user, $share_passwd);
|
||||
$dd->open( $owncloud);
|
||||
|
||||
# create a remote dir
|
||||
|
@ -769,9 +765,7 @@ sub removeShare($$)
|
|||
|
||||
my $dd = HTTP::DAV->new();
|
||||
|
||||
$dd->credentials( -url => $owncloud, -realm=>"ownCloud",
|
||||
-user => $share_user,
|
||||
-pass => $share_passwd );
|
||||
setCredentials($dd, $share_user, $share_passwd);
|
||||
$dd->open( $owncloud);
|
||||
|
||||
my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 });
|
||||
|
|
|
@ -146,9 +146,9 @@ assertLocalAndRemoteDir( '', 0);
|
|||
|
||||
# create a true conflict.
|
||||
printInfo( "Create a conflict." );
|
||||
system( "echo \"This is more stuff\" >> /tmp/kernelcrash.txt" );
|
||||
system( "echo \"This is more server stuff\" >> /tmp/kernelcrash.txt" );
|
||||
put_to_dir( '/tmp/kernelcrash.txt', 'remoteToLocal1' );
|
||||
system( "sleep 2 && touch " . localDir() . "remoteToLocal1/kernelcrash.txt" );
|
||||
system( "sleep 2 && echo \"This is more client stuff\" >> " . localDir() . "remoteToLocal1/kernelcrash.txt" );
|
||||
csync();
|
||||
assertLocalAndRemoteDir( '', 1);
|
||||
|
||||
|
|
|
@ -59,19 +59,18 @@ my $emlpropafter = remoteFileProp("", "test.eml");
|
|||
assert($txtpropafter);
|
||||
assert($emlpropafter);
|
||||
|
||||
# The txt file is uploaded normally, etag and mtime differ
|
||||
assert($txtpropafter->get_property( "getetag" ) ne
|
||||
# The both files were not uploaded, nothing differs
|
||||
assert($txtpropafter->get_property( "getetag" ) eq
|
||||
$txtpropbefore->get_property( "getetag" ));
|
||||
assert($txtpropafter->get_property( "getlastmodified" ) ne
|
||||
assert($txtpropafter->get_property( "getlastmodified" ) eq
|
||||
$txtpropbefore->get_property( "getlastmodified" ));
|
||||
# The eml was not uploaded, nothing differs
|
||||
assert($emlpropafter->get_property( "getetag" ) eq
|
||||
$emlpropbefore->get_property( "getetag" ));
|
||||
assert($emlpropafter->get_property( "getlastmodified" ) eq
|
||||
$emlpropbefore->get_property( "getlastmodified" ));
|
||||
|
||||
printInfo( "Change content of eml file (but not size)");
|
||||
system( "sed -i -e 's/in/IN/' $locDir/test.eml" );
|
||||
system( "sleep 1 && sed -i -e 's/in/IN/' $locDir/test.eml" );
|
||||
|
||||
csync( );
|
||||
|
||||
|
|
Loading…
Reference in a new issue