Merge branch 'master' of git://github.com/plainblack/webgui
This commit is contained in:
commit
45fca0cace
4 changed files with 71 additions and 37 deletions
|
|
@ -44,6 +44,8 @@ This package provides a mechanism for storing and retrieving files that are not
|
||||||
$store = WebGUI::Storage->createTemp($self->session);
|
$store = WebGUI::Storage->createTemp($self->session);
|
||||||
$store = WebGUI::Storage->get($self->session,$id);
|
$store = WebGUI::Storage->get($self->session,$id);
|
||||||
|
|
||||||
|
$exists = WebGUI::Storage->storageExists($session, $id);
|
||||||
|
|
||||||
$filename = $store->addFileFromFilesystem($pathToFile);
|
$filename = $store->addFileFromFilesystem($pathToFile);
|
||||||
$filename = $store->addFileFromFormPost($formVarName,$attachmentLimit);
|
$filename = $store->addFileFromFormPost($formVarName,$attachmentLimit);
|
||||||
$filename = $store->addFileFromHashref($filename,$hashref);
|
$filename = $store->addFileFromHashref($filename,$hashref);
|
||||||
|
|
@ -1714,6 +1716,33 @@ sub setPrivileges {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 storageExists ( $session, $storageId )
|
||||||
|
|
||||||
|
Class method to determine if a storage location exists. This can't be done
|
||||||
|
with C<get> since it will create it if it doesn't exist. Returns true if the
|
||||||
|
storage directory exists.
|
||||||
|
|
||||||
|
=head3 $session
|
||||||
|
|
||||||
|
A session object, used to find the uploadsPath location
|
||||||
|
|
||||||
|
=head3 $storageId
|
||||||
|
|
||||||
|
A WebGUI::Storage GUID.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub storageExists {
|
||||||
|
my ($class, $session, $storageId) = @_;
|
||||||
|
my $hexId = $session->id->toHex($storageId);
|
||||||
|
my @parts = ($hexId =~ m/^((.{2})(.{2}).+)/)[1,2,0];
|
||||||
|
my $dir = Path::Class::Dir->new($session->config->get('uploadsPath'), @parts);
|
||||||
|
return (-e $dir->stringify && -d _ ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 syncToCdn ( )
|
=head2 syncToCdn ( )
|
||||||
|
|
|
||||||
|
|
@ -631,7 +631,7 @@ is(readlink $symlinkedRoot->stringify, $parentPath, 'exportSymlinkRoot sets up l
|
||||||
unlink $symlinkedRoot->stringify;
|
unlink $symlinkedRoot->stringify;
|
||||||
|
|
||||||
subtest exportRelated => sub {
|
subtest exportRelated => sub {
|
||||||
my $old = WebGUI::VersionTag->getWorking($session);
|
my $old = WebGUI::VersionTag->getWorking($session, 'noCreate');
|
||||||
my $tag = WebGUI::VersionTag->create($session);
|
my $tag = WebGUI::VersionTag->create($session);
|
||||||
$tag->setWorking();
|
$tag->setWorking();
|
||||||
my $topic = $parent->addChild({
|
my $topic = $parent->addChild({
|
||||||
|
|
@ -646,7 +646,7 @@ subtest exportRelated => sub {
|
||||||
keywords => 'relatedAssetTesting',
|
keywords => 'relatedAssetTesting',
|
||||||
});
|
});
|
||||||
$tag->commit();
|
$tag->commit();
|
||||||
my $cleanup = guard { $old->setWorking(); $tag->rollback };
|
my $cleanup = guard { $tag->rollback; if ($old) { $old->setWorking(); } };
|
||||||
cmp_deeply(
|
cmp_deeply(
|
||||||
$archive->exportGetAssetIds({ depth => 99, exportRelated => 1}),
|
$archive->exportGetAssetIds({ depth => 99, exportRelated => 1}),
|
||||||
superbagof(map { $_->getId } ($topic, $archive, $story)),
|
superbagof(map { $_->getId } ($topic, $archive, $story)),
|
||||||
|
|
@ -658,7 +658,6 @@ subtest exportRelated => sub {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# exportGetDescendants()
|
# exportGetDescendants()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,12 +98,7 @@ is ($duplicateFilename, $filename, "duplicate method copies collateral");
|
||||||
$duplicateArticle->purge();
|
$duplicateArticle->purge();
|
||||||
|
|
||||||
# The get method will create the directory if it doesnt exist... very strange.
|
# The get method will create the directory if it doesnt exist... very strange.
|
||||||
$duplicateStorage = WebGUI::Storage->get($session,$duplicateStorageId);
|
ok (!WebGUI::Storage->storageExists($session, $duplicateStorageId), 'purge method deletes collateral');
|
||||||
|
|
||||||
# so lets check for the file instead
|
|
||||||
$duplicateFilename = $duplicateStorage->getFiles->[0];
|
|
||||||
|
|
||||||
is ($duplicateFilename, undef, 'purge method deletes collateral');
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
67
t/Storage.t
67
t/Storage.t
|
|
@ -31,7 +31,7 @@ my $cwd = Cwd::cwd();
|
||||||
|
|
||||||
my ($extensionTests, $fileIconTests, $block_extension_tests) = setupDataDrivenTests($session);
|
my ($extensionTests, $fileIconTests, $block_extension_tests) = setupDataDrivenTests($session);
|
||||||
|
|
||||||
plan tests => 155
|
plan tests => 157
|
||||||
+ scalar @{ $extensionTests }
|
+ scalar @{ $extensionTests }
|
||||||
+ scalar @{ $fileIconTests }
|
+ scalar @{ $fileIconTests }
|
||||||
+ scalar @{ $block_extension_tests }
|
+ scalar @{ $block_extension_tests }
|
||||||
|
|
@ -56,7 +56,7 @@ my $storage1 = WebGUI::Storage->get($session);
|
||||||
is( $storage1, undef, "get requires id to be passed");
|
is( $storage1, undef, "get requires id to be passed");
|
||||||
|
|
||||||
$storage1 = WebGUI::Storage->get($session, 'foobar');
|
$storage1 = WebGUI::Storage->get($session, 'foobar');
|
||||||
addToCleanup($storage1);
|
WebGUI::Test->addToCleanup($storage1);
|
||||||
|
|
||||||
isa_ok( $storage1, "WebGUI::Storage", "storage will accept non GUID arguments");
|
isa_ok( $storage1, "WebGUI::Storage", "storage will accept non GUID arguments");
|
||||||
is ( $storage1->getId, 'foobar', 'getId returns the requested GUID');
|
is ( $storage1->getId, 'foobar', 'getId returns the requested GUID');
|
||||||
|
|
@ -83,7 +83,7 @@ $guidDir->mkpath();
|
||||||
ok(-e $guidDir->stringify, 'created GUID storage location for backwards compatibility testing');
|
ok(-e $guidDir->stringify, 'created GUID storage location for backwards compatibility testing');
|
||||||
|
|
||||||
my $guidStorage = WebGUI::Storage->get($session, $newGuid);
|
my $guidStorage = WebGUI::Storage->get($session, $newGuid);
|
||||||
addToCleanup($guidStorage);
|
WebGUI::Test->addToCleanup($guidStorage);
|
||||||
isa_ok($guidStorage, 'WebGUI::Storage');
|
isa_ok($guidStorage, 'WebGUI::Storage');
|
||||||
is($guidStorage->getId, $newGuid, 'GUID storage has correct id');
|
is($guidStorage->getId, $newGuid, 'GUID storage has correct id');
|
||||||
is($guidStorage->getDirectoryId, $newGuid, '... getDirectoryId');
|
is($guidStorage->getDirectoryId, $newGuid, '... getDirectoryId');
|
||||||
|
|
@ -118,7 +118,7 @@ undef $storage1;
|
||||||
|
|
||||||
$storage1 = WebGUI::Storage->get($session, 'notAGUID');
|
$storage1 = WebGUI::Storage->get($session, 'notAGUID');
|
||||||
my $storage2 = WebGUI::Storage->get($session, 'notAGoodId');
|
my $storage2 = WebGUI::Storage->get($session, 'notAGoodId');
|
||||||
addToCleanup($storage2);
|
WebGUI::Test->addToCleanup($storage2);
|
||||||
|
|
||||||
ok(! $storage2->getErrorCount, 'No errors due to a shared common root');
|
ok(! $storage2->getErrorCount, 'No errors due to a shared common root');
|
||||||
|
|
||||||
|
|
@ -150,7 +150,7 @@ CHECKDIR: while ($dirOpt = pop @dirOptions) {
|
||||||
last CHECKDIR if !-e $dir3;
|
last CHECKDIR if !-e $dir3;
|
||||||
}
|
}
|
||||||
my $storage3 = WebGUI::Storage->get($session, $dirOpt);
|
my $storage3 = WebGUI::Storage->get($session, $dirOpt);
|
||||||
addToCleanup($storage3);
|
WebGUI::Test->addToCleanup($storage3);
|
||||||
|
|
||||||
is( $storage3->getErrorCount, 1, 'Error during creation of object due to short GUID');
|
is( $storage3->getErrorCount, 1, 'Error during creation of object due to short GUID');
|
||||||
|
|
||||||
|
|
@ -161,6 +161,17 @@ SKIP: {
|
||||||
|
|
||||||
undef $storage3;
|
undef $storage3;
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
#
|
||||||
|
# storageExists
|
||||||
|
#
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
my $existingStorage = WebGUI::Storage->create($session);
|
||||||
|
WebGUI::Test->addToCleanup($existingStorage);
|
||||||
|
ok(WebGUI::Storage->storageExists($session, $existingStorage->getId), "storageExists returns true when the storage exists");
|
||||||
|
ok(!WebGUI::Storage->storageExists($session, 'Never_WebGUI_GUID'), "... and false when it doesn't");
|
||||||
|
|
||||||
####################################################
|
####################################################
|
||||||
#
|
#
|
||||||
# create, getHexId
|
# create, getHexId
|
||||||
|
|
@ -226,7 +237,7 @@ foreach my $extTest (@{ $extensionTests }) {
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
my $fileStore = WebGUI::Storage->create($session);
|
my $fileStore = WebGUI::Storage->create($session);
|
||||||
addToCleanup($fileStore);
|
WebGUI::Test->addToCleanup($fileStore);
|
||||||
cmp_bag($fileStore->getFiles(1), ['.'], 'Starting with an empty storage object, no files in here except for . ');
|
cmp_bag($fileStore->getFiles(1), ['.'], 'Starting with an empty storage object, no files in here except for . ');
|
||||||
$fileStore->addFileFromScalar('.dotfile', 'dot file');
|
$fileStore->addFileFromScalar('.dotfile', 'dot file');
|
||||||
cmp_bag($fileStore->getFiles(), [ ], 'getFiles() by default does not return dot files');
|
cmp_bag($fileStore->getFiles(), [ ], 'getFiles() by default does not return dot files');
|
||||||
|
|
@ -306,22 +317,22 @@ ok(
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
my $copiedStorage = $storage1->copy();
|
my $copiedStorage = $storage1->copy();
|
||||||
addToCleanup($copiedStorage);
|
WebGUI::Test->addToCleanup($copiedStorage);
|
||||||
cmp_bag($copiedStorage->getFiles(), $storage1->getFiles(), 'copy: both storage objects have the same files');
|
cmp_bag($copiedStorage->getFiles(), $storage1->getFiles(), 'copy: both storage objects have the same files');
|
||||||
|
|
||||||
my $secondCopy = WebGUI::Storage->create($session);
|
my $secondCopy = WebGUI::Storage->create($session);
|
||||||
addToCleanup($secondCopy);
|
WebGUI::Test->addToCleanup($secondCopy);
|
||||||
$storage1->copy($secondCopy);
|
$storage1->copy($secondCopy);
|
||||||
cmp_bag($secondCopy->getFiles(), $storage1->getFiles(), 'copy: passing explicit variable');
|
cmp_bag($secondCopy->getFiles(), $storage1->getFiles(), 'copy: passing explicit variable');
|
||||||
|
|
||||||
my $s3copy = WebGUI::Storage->create($session);
|
my $s3copy = WebGUI::Storage->create($session);
|
||||||
addToCleanup($s3copy);
|
WebGUI::Test->addToCleanup($s3copy);
|
||||||
my @filesToCopy = qw/littleTextFile testfile-hash-renamed.file/;
|
my @filesToCopy = qw/littleTextFile testfile-hash-renamed.file/;
|
||||||
$storage1->copy($s3copy, [@filesToCopy]);
|
$storage1->copy($s3copy, [@filesToCopy]);
|
||||||
cmp_bag($s3copy->getFiles(), [ @filesToCopy ], 'copy: passing explicit variable and files to copy');
|
cmp_bag($s3copy->getFiles(), [ @filesToCopy ], 'copy: passing explicit variable and files to copy');
|
||||||
{
|
{
|
||||||
my $deepStorage = WebGUI::Storage->create($session);
|
my $deepStorage = WebGUI::Storage->create($session);
|
||||||
addToCleanup($deepStorage);
|
WebGUI::Test->addToCleanup($deepStorage);
|
||||||
my $deepDir = $deepStorage->getPathClassDir();
|
my $deepDir = $deepStorage->getPathClassDir();
|
||||||
my $deepDeepDir = $deepDir->subdir('deep');
|
my $deepDeepDir = $deepDir->subdir('deep');
|
||||||
my $errorStr;
|
my $errorStr;
|
||||||
|
|
@ -333,7 +344,7 @@ cmp_bag($s3copy->getFiles(), [ @filesToCopy ], 'copy: passing explicit variable
|
||||||
'... storage setup for deep clear test'
|
'... storage setup for deep clear test'
|
||||||
);
|
);
|
||||||
my $deepCopy = $deepStorage->copy();
|
my $deepCopy = $deepStorage->copy();
|
||||||
addToCleanup($deepCopy);
|
WebGUI::Test->addToCleanup($deepCopy);
|
||||||
cmp_bag(
|
cmp_bag(
|
||||||
$deepCopy->getFiles('all'),
|
$deepCopy->getFiles('all'),
|
||||||
[ '.', 'deep', 'deep/file' ],
|
[ '.', 'deep', 'deep/file' ],
|
||||||
|
|
@ -356,7 +367,7 @@ cmp_bag($storage1->getFiles, [$filename], 'deleteFile: storage1 has only 1 file'
|
||||||
|
|
||||||
##Test for out of object file deletion
|
##Test for out of object file deletion
|
||||||
my $hackedStore = WebGUI::Storage->create($session);
|
my $hackedStore = WebGUI::Storage->create($session);
|
||||||
addToCleanup($hackedStore);
|
WebGUI::Test->addToCleanup($hackedStore);
|
||||||
$hackedStore->addFileFromScalar('fileToHack', 'Can this file be deleted from another object?');
|
$hackedStore->addFileFromScalar('fileToHack', 'Can this file be deleted from another object?');
|
||||||
ok(-e $hackedStore->getPath('fileToHack'), 'set up a file for deleteFile to try and delete illegally');
|
ok(-e $hackedStore->getPath('fileToHack'), 'set up a file for deleteFile to try and delete illegally');
|
||||||
my $hackedPath = '../../../'.$hackedStore->getPathFrag().'/fileToHack';
|
my $hackedPath = '../../../'.$hackedStore->getPathFrag().'/fileToHack';
|
||||||
|
|
@ -370,7 +381,7 @@ ok(-e $hackedStore->getPath('fileToHack'), 'deleteFile did not delete the file i
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
my $tempStor = WebGUI::Storage->createTemp($session);
|
my $tempStor = WebGUI::Storage->createTemp($session);
|
||||||
addToCleanup($tempStor);
|
WebGUI::Test->addToCleanup($tempStor);
|
||||||
|
|
||||||
isa_ok( $tempStor, "WebGUI::Storage", "createTemp creates WebGUI::Storage object");
|
isa_ok( $tempStor, "WebGUI::Storage", "createTemp creates WebGUI::Storage object");
|
||||||
is (substr($tempStor->getPathFrag, 0, 5), 'temp/', '... puts stuff in the temp directory');
|
is (substr($tempStor->getPathFrag, 0, 5), 'temp/', '... puts stuff in the temp directory');
|
||||||
|
|
@ -396,7 +407,7 @@ foreach my $extTest (@{ $block_extension_tests }) {
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
my $tarStorage = $copiedStorage->tar('tar.tar');
|
my $tarStorage = $copiedStorage->tar('tar.tar');
|
||||||
addToCleanup($tarStorage);
|
WebGUI::Test->addToCleanup($tarStorage);
|
||||||
isa_ok( $tarStorage, "WebGUI::Storage", "tar: returns a WebGUI::Storage object");
|
isa_ok( $tarStorage, "WebGUI::Storage", "tar: returns a WebGUI::Storage object");
|
||||||
is (substr($tarStorage->getPathFrag, 0, 5), 'temp/', 'tar: puts stuff in the temp directory');
|
is (substr($tarStorage->getPathFrag, 0, 5), 'temp/', 'tar: puts stuff in the temp directory');
|
||||||
cmp_bag($tarStorage->getFiles(), [ 'tar.tar' ], 'tar: storage contains only the tar file');
|
cmp_bag($tarStorage->getFiles(), [ 'tar.tar' ], 'tar: storage contains only the tar file');
|
||||||
|
|
@ -409,7 +420,7 @@ isnt($tarStorage->getPath, $copiedStorage->getPath, 'tar did not reuse the same
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
my $untarStorage = $tarStorage->untar('tar.tar');
|
my $untarStorage = $tarStorage->untar('tar.tar');
|
||||||
addToCleanup($untarStorage);
|
WebGUI::Test->addToCleanup($untarStorage);
|
||||||
isa_ok( $untarStorage, "WebGUI::Storage", "untar: returns a WebGUI::Storage object");
|
isa_ok( $untarStorage, "WebGUI::Storage", "untar: returns a WebGUI::Storage object");
|
||||||
is (substr($untarStorage->getPathFrag, 0, 5), 'temp/', 'untar: puts stuff in the temp directory');
|
is (substr($untarStorage->getPathFrag, 0, 5), 'temp/', 'untar: puts stuff in the temp directory');
|
||||||
cmp_bag($untarStorage->getFiles, $copiedStorage->getFiles, 'tar and untar loop preserve all files');
|
cmp_bag($untarStorage->getFiles, $copiedStorage->getFiles, 'tar and untar loop preserve all files');
|
||||||
|
|
@ -458,7 +469,7 @@ cmp_bag(
|
||||||
|
|
||||||
{
|
{
|
||||||
my $deepStorage = WebGUI::Storage->create($session);
|
my $deepStorage = WebGUI::Storage->create($session);
|
||||||
addToCleanup($deepStorage);
|
WebGUI::Test->addToCleanup($deepStorage);
|
||||||
my $deepDir = $deepStorage->getPathClassDir();
|
my $deepDir = $deepStorage->getPathClassDir();
|
||||||
my $deepDeepDir = $deepDir->subdir('deep');
|
my $deepDeepDir = $deepDir->subdir('deep');
|
||||||
my $errorStr;
|
my $errorStr;
|
||||||
|
|
@ -489,7 +500,7 @@ is($fileStore->addFileFromFormPost(), '', 'addFileFromFormPost returns empty str
|
||||||
$session->http->setStatus(200);
|
$session->http->setStatus(200);
|
||||||
$session->request->upload('files', []);
|
$session->request->upload('files', []);
|
||||||
my $formStore = WebGUI::Storage->create($session);
|
my $formStore = WebGUI::Storage->create($session);
|
||||||
addToCleanup($formStore);
|
WebGUI::Test->addToCleanup($formStore);
|
||||||
is($formStore->addFileFromFormPost('files'), undef, 'addFileFromFormPost returns empty string when asking for a form variable with no files attached');
|
is($formStore->addFileFromFormPost('files'), undef, 'addFileFromFormPost returns empty string when asking for a form variable with no files attached');
|
||||||
|
|
||||||
$session->request->uploadFiles(
|
$session->request->uploadFiles(
|
||||||
|
|
@ -519,7 +530,7 @@ foreach my $iconTest (@{ $fileIconTests }) {
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# writeAccess
|
# writeAccess
|
||||||
my $shallowStorage = WebGUI::Storage->create($session);
|
my $shallowStorage = WebGUI::Storage->create($session);
|
||||||
addToCleanup($shallowStorage);
|
WebGUI::Test->addToCleanup($shallowStorage);
|
||||||
$shallowStorage->writeAccess( users => ["3"], groups => ["2"], assets => ["1"] );
|
$shallowStorage->writeAccess( users => ["3"], groups => ["2"], assets => ["1"] );
|
||||||
my $shallowDir = $shallowStorage->getPathClassDir();
|
my $shallowDir = $shallowStorage->getPathClassDir();
|
||||||
ok(-e $shallowDir->file('.wgaccess')->stringify, 'writeAccess: .wgaccess file created in shallow storage');
|
ok(-e $shallowDir->file('.wgaccess')->stringify, 'writeAccess: .wgaccess file created in shallow storage');
|
||||||
|
|
@ -529,7 +540,7 @@ is ($privs, '{"assets":["1"],"groups":["2"],"users":["3"]}', '... correct group
|
||||||
$shallowStorage->deleteFile('.wgaccess');
|
$shallowStorage->deleteFile('.wgaccess');
|
||||||
|
|
||||||
my $deepStorage = WebGUI::Storage->create($session);
|
my $deepStorage = WebGUI::Storage->create($session);
|
||||||
addToCleanup($deepStorage);
|
WebGUI::Test->addToCleanup($deepStorage);
|
||||||
my $deepDir = $deepStorage->getPathClassDir();
|
my $deepDir = $deepStorage->getPathClassDir();
|
||||||
my $deepDeepDir = $deepDir->subdir('deep');
|
my $deepDeepDir = $deepDir->subdir('deep');
|
||||||
my $errorStr;
|
my $errorStr;
|
||||||
|
|
@ -548,7 +559,7 @@ is ($privs, '{"assets":["1"],"groups":["2"],"users":["3"]}', '... correct group
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# trash
|
# trash
|
||||||
my $shallowStorage = WebGUI::Storage->create($session);
|
my $shallowStorage = WebGUI::Storage->create($session);
|
||||||
addToCleanup($shallowStorage);
|
WebGUI::Test->addToCleanup($shallowStorage);
|
||||||
$shallowStorage->trash;
|
$shallowStorage->trash;
|
||||||
my $shallowDir = $shallowStorage->getPathClassDir();
|
my $shallowDir = $shallowStorage->getPathClassDir();
|
||||||
ok(-e $shallowDir->file('.wgaccess')->stringify, 'trash: .wgaccess file created in shallow storage');
|
ok(-e $shallowDir->file('.wgaccess')->stringify, 'trash: .wgaccess file created in shallow storage');
|
||||||
|
|
@ -558,7 +569,7 @@ is ($privs, '{"state":"trash"}', '... correct state');
|
||||||
$shallowStorage->deleteFile('.wgaccess');
|
$shallowStorage->deleteFile('.wgaccess');
|
||||||
|
|
||||||
my $deepStorage = WebGUI::Storage->create($session);
|
my $deepStorage = WebGUI::Storage->create($session);
|
||||||
addToCleanup($deepStorage);
|
WebGUI::Test->addToCleanup($deepStorage);
|
||||||
my $deepDir = $deepStorage->getPathClassDir();
|
my $deepDir = $deepStorage->getPathClassDir();
|
||||||
my $deepDeepDir = $deepDir->subdir('deep');
|
my $deepDeepDir = $deepDir->subdir('deep');
|
||||||
my $errorStr;
|
my $errorStr;
|
||||||
|
|
@ -581,7 +592,7 @@ is ($privs, '{"state":"trash"}', '... correct state contents, deep storage subdi
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
my $shallowStorage = WebGUI::Storage->create($session);
|
my $shallowStorage = WebGUI::Storage->create($session);
|
||||||
addToCleanup($shallowStorage);
|
WebGUI::Test->addToCleanup($shallowStorage);
|
||||||
$shallowStorage->setPrivileges(3,3,3);
|
$shallowStorage->setPrivileges(3,3,3);
|
||||||
my $shallowDir = $shallowStorage->getPathClassDir();
|
my $shallowDir = $shallowStorage->getPathClassDir();
|
||||||
ok(-e $shallowDir->file('.wgaccess')->stringify, 'setPrivilege: .wgaccess file created in shallow storage');
|
ok(-e $shallowDir->file('.wgaccess')->stringify, 'setPrivilege: .wgaccess file created in shallow storage');
|
||||||
|
|
@ -591,7 +602,7 @@ is ($privs, '{"assets":[],"groups":["3","3"],"users":["3"]}', '... correct group
|
||||||
$shallowStorage->deleteFile('.wgaccess');
|
$shallowStorage->deleteFile('.wgaccess');
|
||||||
|
|
||||||
my $deepStorage = WebGUI::Storage->create($session);
|
my $deepStorage = WebGUI::Storage->create($session);
|
||||||
addToCleanup($deepStorage);
|
WebGUI::Test->addToCleanup($deepStorage);
|
||||||
my $deepDir = $deepStorage->getPathClassDir();
|
my $deepDir = $deepStorage->getPathClassDir();
|
||||||
my $deepDeepDir = $deepDir->subdir('deep');
|
my $deepDeepDir = $deepDir->subdir('deep');
|
||||||
my $errorStr;
|
my $errorStr;
|
||||||
|
|
@ -609,7 +620,7 @@ is ($privs, '{"assets":[],"groups":["3","3"],"users":["3"]}', '... correct group
|
||||||
|
|
||||||
{
|
{
|
||||||
my $storage = WebGUI::Storage->create($session);
|
my $storage = WebGUI::Storage->create($session);
|
||||||
addToCleanup($storage);
|
WebGUI::Test->addToCleanup($storage);
|
||||||
my $asset = WebGUI::Asset->getRoot($session);
|
my $asset = WebGUI::Asset->getRoot($session);
|
||||||
$storage->setPrivileges( $asset );
|
$storage->setPrivileges( $asset );
|
||||||
my $accessFile = $storage->getPathClassDir->file('.wgaccess');
|
my $accessFile = $storage->getPathClassDir->file('.wgaccess');
|
||||||
|
|
@ -626,7 +637,7 @@ is ($privs, '{"assets":[],"groups":["3","3"],"users":["3"]}', '... correct group
|
||||||
|
|
||||||
# Create new storage for test of 'rotate' method
|
# Create new storage for test of 'rotate' method
|
||||||
my $rotateTestStorage = WebGUI::Storage->create($session);
|
my $rotateTestStorage = WebGUI::Storage->create($session);
|
||||||
addToCleanup($rotateTestStorage);
|
WebGUI::Test->addToCleanup($rotateTestStorage);
|
||||||
|
|
||||||
# Add test image from file system
|
# Add test image from file system
|
||||||
my $file = "rotation_test.png";
|
my $file = "rotation_test.png";
|
||||||
|
|
@ -673,7 +684,7 @@ $session->config->set('cdn', $cdnCfg);
|
||||||
my $cdnUrl = $cdnCfg->{'url'};
|
my $cdnUrl = $cdnCfg->{'url'};
|
||||||
my $cdnUlen = length $cdnUrl;
|
my $cdnUlen = length $cdnUrl;
|
||||||
my $cdnStorage = WebGUI::Storage->create($session);
|
my $cdnStorage = WebGUI::Storage->create($session);
|
||||||
addToCleanup($cdnStorage);
|
WebGUI::Test->addToCleanup($cdnStorage);
|
||||||
# Functional URL before sync done
|
# Functional URL before sync done
|
||||||
my $hexId = $session->id->toHex($cdnStorage->getId);
|
my $hexId = $session->id->toHex($cdnStorage->getId);
|
||||||
my $initUrl = join '/', $uploadUrl, $cdnStorage->getPathFrag;
|
my $initUrl = join '/', $uploadUrl, $cdnStorage->getPathFrag;
|
||||||
|
|
@ -737,7 +748,7 @@ $mockEnv{HTTPS} = undef;
|
||||||
is ($cdnStorage->getUrl, $locUrl, 'CDN: getUrl: cleartext request to not use sslUrl');
|
is ($cdnStorage->getUrl, $locUrl, 'CDN: getUrl: cleartext request to not use sslUrl');
|
||||||
# Copy
|
# Copy
|
||||||
my $cdnCopy = $cdnStorage->copy;
|
my $cdnCopy = $cdnStorage->copy;
|
||||||
addToCleanup($cdnCopy);
|
WebGUI::Test->addToCleanup($cdnCopy);
|
||||||
my $qcp = $cdnCfg->{'queuePath'} . '/' . $session->id->toHex($cdnCopy->getId);
|
my $qcp = $cdnCfg->{'queuePath'} . '/' . $session->id->toHex($cdnCopy->getId);
|
||||||
ok (-e $qcp, 'CDN: queue file created when storage location copied');
|
ok (-e $qcp, 'CDN: queue file created when storage location copied');
|
||||||
my $dotcp = $cdnCopy->getPath . '/.cdn';
|
my $dotcp = $cdnCopy->getPath . '/.cdn';
|
||||||
|
|
@ -774,7 +785,7 @@ $session->config->delete('cdn');
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
my $zombieStorage = WebGUI::Storage->create($session);
|
my $zombieStorage = WebGUI::Storage->create($session);
|
||||||
addToCleanup($zombieStorage);
|
WebGUI::Test->addToCleanup($zombieStorage);
|
||||||
my $zombieDir = $zombieStorage->getPathClassDir;
|
my $zombieDir = $zombieStorage->getPathClassDir;
|
||||||
$zombieDir->remove;
|
$zombieDir->remove;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue