diff options
Diffstat (limited to 't/app/model/photoset.t')
-rw-r--r-- | t/app/model/photoset.t | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/t/app/model/photoset.t b/t/app/model/photoset.t index d171ba88b..29a28d232 100644 --- a/t/app/model/photoset.t +++ b/t/app/model/photoset.t @@ -15,7 +15,10 @@ my $db = FixMyStreet::DB->schema; my $user = $db->resultset('User')->find_or_create({ name => 'Bob', email => 'bob@example.com' }); FixMyStreet::override_config { - UPLOAD_DIR => $UPLOAD_DIR, + PHOTO_STORAGE_BACKEND => 'FileSystem', + PHOTO_STORAGE_OPTIONS => { + UPLOAD_DIR => $UPLOAD_DIR, + }, }, sub { my $image_path = path('t/app/controller/sample.jpg'); @@ -69,4 +72,29 @@ subtest 'Photoset with 3 referenced photo' => sub { }; +subtest 'Correct storage backends are instantiated' => sub { + FixMyStreet::override_config { + PHOTO_STORAGE_BACKEND => 'FileSystem' + }, sub { + my $photoset = FixMyStreet::App::Model::PhotoSet->new; + isa_ok $photoset->storage, 'FixMyStreet::PhotoStorage::FileSystem'; + }; + + FixMyStreet::override_config { + PHOTO_STORAGE_BACKEND => undef + }, sub { + my $photoset = FixMyStreet::App::Model::PhotoSet->new; + isa_ok $photoset->storage, 'FixMyStreet::PhotoStorage::FileSystem'; + }; + + FixMyStreet::override_config { + PHOTO_STORAGE_BACKEND => 'S3' + }, sub { + my $photoset = FixMyStreet::App::Model::PhotoSet->new; + isa_ok $photoset->storage, 'FixMyStreet::PhotoStorage::S3'; + }; + +}; + + done_testing(); |