diff options
author | Marius Halden <marius.h@lden.org> | 2020-09-29 14:23:52 +0200 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2020-09-29 14:23:52 +0200 |
commit | a27ce1524d801d2742a2bdb6ec1da45126d64353 (patch) | |
tree | 64123c4e17dc1776aa0a7cd65ee01d49d3e7d978 /t/app/controller/admin/update_edit.t | |
parent | 377bd96aab7cad3434185c30eb908c9da447fe40 (diff) | |
parent | 2773c60226b9370fe8ee00f7b205b571bb87c3b5 (diff) |
Merge tag 'v3.0.1' into fiksgatami-dev
Diffstat (limited to 't/app/controller/admin/update_edit.t')
-rw-r--r-- | t/app/controller/admin/update_edit.t | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/t/app/controller/admin/update_edit.t b/t/app/controller/admin/update_edit.t index 6ddbdbdfc..57c8973d4 100644 --- a/t/app/controller/admin/update_edit.t +++ b/t/app/controller/admin/update_edit.t @@ -10,7 +10,7 @@ my $user2 = $mech->create_user_ok('test2@example.com', name => 'Test User 2'); my $superuser = $mech->create_user_ok('superuser@example.com', name => 'Super User', is_superuser => 1); -my $user3 = FixMyStreet::App->model('DB::User')->create( { email => 'test3@example.com' } ); +my $user3 = FixMyStreet::DB->resultset('User')->create( { email => 'test3@example.com' } ); my $dt = DateTime->new( year => 2011, @@ -21,7 +21,7 @@ my $dt = DateTime->new( second => 23 ); -my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( +my $report = FixMyStreet::DB->resultset('Problem')->find_or_create( { postcode => 'SW1A 1AA', bodies_str => '2504', @@ -52,7 +52,7 @@ $mech->log_in_ok( $superuser->email ); my $report_id = $report->id; ok $report, "created test report - $report_id"; -my $update = FixMyStreet::App->model('DB::Comment')->create( +my $update = FixMyStreet::DB->resultset('Comment')->create( { text => 'this is an update', user => $user, @@ -63,7 +63,7 @@ my $update = FixMyStreet::App->model('DB::Comment')->create( } ); -my $log_entries = FixMyStreet::App->model('DB::AdminLog')->search( +my $log_entries = FixMyStreet::DB->resultset('AdminLog')->search( { object_type => 'update', object_id => $update->id @@ -83,7 +83,7 @@ for my $test ( state => 'confirmed', name => '', anonymous => 1, - username => 'test@example.com', + username => $update->user->email, }, changes => { text => 'this is a changed update', @@ -98,7 +98,7 @@ for my $test ( state => 'confirmed', name => '', anonymous => 1, - username => 'test@example.com', + username => $update->user->email, }, changes => { name => 'A User', @@ -113,7 +113,7 @@ for my $test ( state => 'confirmed', name => 'A User', anonymous => 1, - username => 'test@example.com', + username => $update->user->email, }, changes => { anonymous => 0, @@ -128,10 +128,10 @@ for my $test ( state => 'confirmed', name => 'A User', anonymous => 0, - username => 'test@example.com', + username => $update->user->email, }, changes => { - username => 'test2@example.com', + username => $user2->email, }, log_count => 4, log_entries => [qw/edit edit edit edit/], @@ -144,7 +144,7 @@ for my $test ( state => 'confirmed', name => 'A User', anonymous => 0, - username => 'test2@example.com', + username => $user2->email, }, changes => { state => 'unconfirmed', @@ -159,7 +159,7 @@ for my $test ( state => 'unconfirmed', name => 'A User', anonymous => 0, - username => 'test2@example.com', + username => $user2->email, }, changes => { text => 'this is a twice changed update', @@ -275,7 +275,7 @@ for my $test ( } subtest 'editing update email creates new user if required' => sub { - my $user = FixMyStreet::App->model('DB::User')->find( { email => 'test4@example.com' } ); + my $user = FixMyStreet::DB->resultset('User')->find( { email => 'test4@example.com' } ); $user->delete if $user; @@ -289,7 +289,7 @@ subtest 'editing update email creates new user if required' => sub { $mech->submit_form_ok( { with_fields => $fields } ); - $user = FixMyStreet::App->model('DB::User')->find( { email => 'test4@example.com' } ); + $user = FixMyStreet::DB->resultset('User')->find( { email => 'test4@example.com' } ); is_deeply $mech->visible_form_values, $fields, 'submitted form values'; @@ -302,7 +302,7 @@ subtest 'editing update email creates new user if required' => sub { subtest 'adding email to abuse list from update page' => sub { my $email = $update->user->email; - my $abuse = FixMyStreet::App->model('DB::Abuse')->find( { email => $email } ); + my $abuse = FixMyStreet::DB->resultset('Abuse')->find( { email => $email } ); $abuse->delete if $abuse; $mech->get_ok( '/admin/update_edit/' . $update->id ); @@ -313,7 +313,7 @@ subtest 'adding email to abuse list from update page' => sub { $mech->content_contains('User added to abuse list'); $mech->content_contains('<small>User in abuse table</small>'); - $abuse = FixMyStreet::App->model('DB::Abuse')->find( { email => $email } ); + $abuse = FixMyStreet::DB->resultset('Abuse')->find( { email => $email } ); ok $abuse, 'entry created in abuse table'; $mech->get_ok( '/admin/update_edit/' . $update->id ); |