use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; $mech->get_ok('/my'); is $mech->uri->path, '/auth', "got sent to the sign in page"; $mech->get_ok('/my/anonymize'); is $mech->uri->path, '/auth', "got sent to the sign in page"; my @problems = $mech->create_problems_for_body(3, 1234, 'Test Title'); $problems[1]->update({anonymous => 1}); my $other_user = FixMyStreet::DB->resultset('User')->find_or_create({ email => 'another@example.com' }); my @other = $mech->create_problems_for_body(1, 1234, 'Another Title', { user => $other_user }); my $user = $mech->log_in_ok( 'test@example.com' ); my @update; my $i = 0; my $staff_text = '

this is an update

'; foreach ($user, $user, $other_user) { $update[$i] = FixMyStreet::DB->resultset('Comment')->create({ text => $staff_text, user => $_, state => 'confirmed', problem => $problems[0], mark_fixed => 0, confirmed => \'current_timestamp', anonymous => $i % 2, }); $i++; } subtest 'Check loading of /my page' => sub { $mech->get_ok('/my'); is $mech->uri->path, '/my', "stayed on '/my' page"; $mech->content_contains('Test Title'); $mech->content_lacks('Another Title'); $mech->content_contains('<p>this is'); $mech->content_lacks('

this is an update