Skip to content

Commit

Permalink
Update tests for 1 day amending delay (MBS-9505)
Browse files Browse the repository at this point in the history
  • Loading branch information
yvanzo committed Oct 19, 2017
1 parent 618e910 commit dcde310
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions t/lib/t/MusicBrainz/Server/Edit/Role/AllowAmending.pm
Expand Up @@ -9,7 +9,7 @@ use MusicBrainz::Server::Constants qw( $EDIT_MEDIUM_EDIT $EDIT_RELEASE_CREATE );

use MusicBrainz::Server::Edit::Medium::Edit;

test 'Allow amending entity within one hour' => sub {
test 'Allow amending entity within one day' => sub {
my $test = shift;
my $c = $test->c;

Expand All @@ -18,18 +18,18 @@ test 'Allow amending entity within one hour' => sub {
my $edit;
my $medium = $c->model('Medium')->get_by_id(1);

subtest 'Auto-edit amending entity created by the same editor within one hour' => sub {
subtest 'Auto-edit amending entity created by the same editor within one day' => sub {
$edit = create_edit($c, $medium, 1411452, 30171);
is($edit->can_amend(1), 1, 'amending allowed');
};

subtest 'Non-auto-edit amending entity created by another editor within one hour' => sub {
subtest 'Non-auto-edit amending entity created by another editor within one day' => sub {
$edit = create_edit($c, $medium, 1411453, 30172);
is($edit->can_amend(1), '', 'amending disallowed');
};

subtest 'Non-auto-edit amending entity created by the same editor after one hour' => sub {
$test->c->sql->do("UPDATE edit SET open_time = NOW() - INTERVAL '1 hour' WHERE type = $EDIT_RELEASE_CREATE;");
subtest 'Non-auto-edit amending entity created by the same editor after one day' => sub {
$test->c->sql->do("UPDATE edit SET open_time = NOW() - INTERVAL '1 day' WHERE type = $EDIT_RELEASE_CREATE;");
$edit = create_edit($c, $medium, 1411454, 30171);
is($edit->can_amend(1), '', 'amending disallowed');
};
Expand Down

0 comments on commit dcde310

Please sign in to comment.