aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/admin
diff options
context:
space:
mode:
Diffstat (limited to 't/app/controller/admin')
-rw-r--r--t/app/controller/admin/bodies.t8
-rw-r--r--t/app/controller/admin/defecttypes.t10
-rw-r--r--t/app/controller/admin/report_edit.t16
-rw-r--r--t/app/controller/admin/reportextrafields.t8
-rw-r--r--t/app/controller/admin/search.t6
-rw-r--r--t/app/controller/admin/templates.t2
-rw-r--r--t/app/controller/admin/triage.t2
-rw-r--r--t/app/controller/admin/users.t12
8 files changed, 32 insertions, 32 deletions
diff --git a/t/app/controller/admin/bodies.t b/t/app/controller/admin/bodies.t
index aaa9bca65..2d09ee85e 100644
--- a/t/app/controller/admin/bodies.t
+++ b/t/app/controller/admin/bodies.t
@@ -142,7 +142,7 @@ subtest 'check open311 configuring' => sub {
$mech->content_contains('Council contacts configured via Open311');
$mech->content_contains('Values updated');
- my $conf = FixMyStreet::App->model('DB::Body')->find( $body->id );
+ my $conf = FixMyStreet::DB->resultset('Body')->find( $body->id );
is $conf->endpoint, 'http://example.com/open311', 'endpoint configured';
is $conf->api_key, 'api key', 'api key configured';
is $conf->jurisdiction, 'mySociety', 'jurisdiction configures';
@@ -162,7 +162,7 @@ subtest 'check open311 configuring' => sub {
$mech->content_contains('Values updated');
- $conf = FixMyStreet::App->model('DB::Body')->find( $body->id );
+ $conf = FixMyStreet::DB->resultset('Body')->find( $body->id );
is $conf->endpoint, 'http://example.org/open311', 'endpoint updated';
is $conf->api_key, 'new api key', 'api key updated';
is $conf->jurisdiction, 'open311', 'jurisdiction configures';
@@ -184,7 +184,7 @@ subtest 'check open311 configuring' => sub {
$mech->content_contains('Values updated');
- $conf = FixMyStreet::App->model('DB::Body')->find( $body->id );
+ $conf = FixMyStreet::DB->resultset('Body')->find( $body->id );
ok $conf->get_extra_metadata('fetch_all_problems'), 'fetch all problems set';
$mech->form_number(3);
@@ -204,7 +204,7 @@ subtest 'check open311 configuring' => sub {
$mech->content_contains('Values updated');
- $conf = FixMyStreet::App->model('DB::Body')->find( $body->id );
+ $conf = FixMyStreet::DB->resultset('Body')->find( $body->id );
ok !$conf->get_extra_metadata('fetch_all_problems'), 'fetch all problems unset';
};
diff --git a/t/app/controller/admin/defecttypes.t b/t/app/controller/admin/defecttypes.t
index 12ae8948c..8589062db 100644
--- a/t/app/controller/admin/defecttypes.t
+++ b/t/app/controller/admin/defecttypes.t
@@ -107,7 +107,7 @@ FixMyStreet::override_config { ALLOWED_COBRANDS => ['oxfordshire'], }, sub {
};
subtest 'check editing a defect type' => sub {
- my $defect = FixMyStreet::App->model('DB::DefectType')->search( {
+ my $defect = FixMyStreet::DB->resultset('DefectType')->search( {
name => 'A defect',
body_id => $body->id
} )->first;
@@ -126,7 +126,7 @@ FixMyStreet::override_config { ALLOWED_COBRANDS => ['oxfordshire'], }, sub {
$mech->content_lacks('A defect');
$mech->content_contains('Updated defect');
- my $defects = FixMyStreet::App->model('DB::DefectType')->search( {
+ my $defects = FixMyStreet::DB->resultset('DefectType')->search( {
body_id => $body->id
} );
@@ -134,7 +134,7 @@ FixMyStreet::override_config { ALLOWED_COBRANDS => ['oxfordshire'], }, sub {
};
subtest 'check adding a category to a defect' => sub {
- my $defect = FixMyStreet::App->model('DB::DefectType')->search( {
+ my $defect = FixMyStreet::DB->resultset('DefectType')->search( {
name => 'Updated defect',
body_id => $body->id
} )->first;
@@ -163,7 +163,7 @@ FixMyStreet::override_config { ALLOWED_COBRANDS => ['oxfordshire'], }, sub {
};
subtest 'check removing category from a defect' => sub {
- my $defect = FixMyStreet::App->model('DB::DefectType')->search( {
+ my $defect = FixMyStreet::DB->resultset('DefectType')->search( {
name => 'Updated defect',
body_id => $body->id
} )->first;
@@ -191,7 +191,7 @@ FixMyStreet::override_config { ALLOWED_COBRANDS => ['oxfordshire'], }, sub {
};
subtest 'check adding codes to a defect' => sub {
- my $defect = FixMyStreet::App->model('DB::DefectType')->search( {
+ my $defect = FixMyStreet::DB->resultset('DefectType')->search( {
name => 'Updated defect',
body_id => $body->id
} )->first;
diff --git a/t/app/controller/admin/report_edit.t b/t/app/controller/admin/report_edit.t
index 85f83781c..438bcc241 100644
--- a/t/app/controller/admin/report_edit.t
+++ b/t/app/controller/admin/report_edit.t
@@ -24,7 +24,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 @@ my $report = FixMyStreet::App->model('DB::Problem')->find_or_create(
$mech->log_in_ok( $superuser->email );
-my $log_entries = FixMyStreet::App->model('DB::AdminLog')->search(
+my $log_entries = FixMyStreet::DB->resultset('AdminLog')->search(
{
object_type => 'problem',
object_id => $report->id
@@ -511,7 +511,7 @@ subtest 'change email to new user' => sub {
username => 'test3@example.com'
};
- my $user3 = FixMyStreet::App->model('DB::User')->find( { email => 'test3@example.com' } );
+ my $user3 = FixMyStreet::DB->resultset('User')->find( { email => 'test3@example.com' } );
ok !$user3, 'user not in database';
@@ -530,7 +530,7 @@ subtest 'change email to new user' => sub {
is $log_entries->first->action, 'edit', 'log action';
is_deeply( $mech->visible_form_values(), $new_fields, 'changed form values' );
- $user3 = FixMyStreet::App->model('DB::User')->find( { email => 'test3@example.com' } );
+ $user3 = FixMyStreet::DB->resultset('User')->find( { email => 'test3@example.com' } );
$report->discard_changes;
@@ -541,7 +541,7 @@ subtest 'change email to new user' => sub {
subtest 'adding email to abuse list from report page' => sub {
my $email = $report->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/report_edit/' . $report->id );
@@ -552,7 +552,7 @@ subtest 'adding email to abuse list from report 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/report_edit/' . $report->id );
@@ -619,7 +619,7 @@ subtest "Test alert count display" => sub {
$mech->get_ok("/admin/report_edit/$report_id");
$mech->content_contains('Alerts: 0');
- my $alert = FixMyStreet::App->model('DB::Alert')->find_or_create(
+ my $alert = FixMyStreet::DB->resultset('Alert')->find_or_create(
{
alert_type => 'new_updates',
parameter => $report_id,
@@ -641,7 +641,7 @@ subtest "Test alert count display" => sub {
$alert->delete;
};
-my $report2 = FixMyStreet::App->model('DB::Problem')->find_or_create(
+my $report2 = FixMyStreet::DB->resultset('Problem')->find_or_create(
{
postcode => 'SW1A 1AA',
bodies_str => '2504',
diff --git a/t/app/controller/admin/reportextrafields.t b/t/app/controller/admin/reportextrafields.t
index 1aa4c6a42..388cc3c95 100644
--- a/t/app/controller/admin/reportextrafields.t
+++ b/t/app/controller/admin/reportextrafields.t
@@ -168,7 +168,7 @@ FixMyStreet::override_config {
subtest 'Create and update new ReportExtraFields' => sub {
my $extra_fields = [];
- my $model = FixMyStreet::App->model('DB::ReportExtraField');
+ my $model = FixMyStreet::DB->resultset('ReportExtraField');
is $model->count, 0, 'no ReportExtraFields yet';
$mech->get_ok("/admin/reportextrafields");
@@ -298,7 +298,7 @@ FixMyStreet::override_config {
LANGUAGES => [ 'en-gb,English,en_GB' ]
}, sub {
subtest "Extra fields are missing from cobrand that doesn't allow them" => sub {
- my $object = FixMyStreet::App->model('DB::ReportExtraField')->first;
+ my $object = FixMyStreet::DB->resultset('ReportExtraField')->first;
$object->update({ language => "", cobrand => ""});
$mech->get_ok("/report/new?longitude=-1.351488&latitude=51.847235&category=" . $contact->category);
@@ -307,7 +307,7 @@ FixMyStreet::override_config {
};
};
-FixMyStreet::App->model('DB::ReportExtraField')->delete_all;
+FixMyStreet::DB->resultset('ReportExtraField')->delete_all;
$mech->log_out_ok;
subtest 'Reports are created with correct extra metadata' => sub {
@@ -315,7 +315,7 @@ subtest 'Reports are created with correct extra metadata' => sub {
ALLOWED_COBRANDS => [ 'tester' ],
MAPIT_URL => 'http://mapit.uk/',
}, sub {
- my $model = FixMyStreet::App->model('DB::ReportExtraField');
+ my $model = FixMyStreet::DB->resultset('ReportExtraField');
my $extra_fields = $model->find_or_create({
name => "Test extra fields",
language => "",
diff --git a/t/app/controller/admin/search.t b/t/app/controller/admin/search.t
index f8e70cb7a..d46843799 100644
--- a/t/app/controller/admin/search.t
+++ b/t/app/controller/admin/search.t
@@ -20,7 +20,7 @@ $mech->create_contact_ok( body_id => $oxford->id, category => 'Graffiti', email
my $bromley = $mech->create_body_ok(2482, 'Bromley Council');
-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,
@@ -31,7 +31,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',
@@ -68,7 +68,7 @@ subtest 'show flagged entries' => sub {
$mech->content_contains( $report->title );
};
-my $update = FixMyStreet::App->model('DB::Comment')->create(
+my $update = FixMyStreet::DB->resultset('Comment')->create(
{
text => 'this is an update',
user => $user,
diff --git a/t/app/controller/admin/templates.t b/t/app/controller/admin/templates.t
index 39903deb1..e9fefbdd7 100644
--- a/t/app/controller/admin/templates.t
+++ b/t/app/controller/admin/templates.t
@@ -19,7 +19,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',
diff --git a/t/app/controller/admin/triage.t b/t/app/controller/admin/triage.t
index 6c84d1ff4..6e134ff67 100644
--- a/t/app/controller/admin/triage.t
+++ b/t/app/controller/admin/triage.t
@@ -75,7 +75,7 @@ FixMyStreet::override_config {
my $report_url = '/report/' . $report->id;
$mech->get_ok($report_url);
- my $alert = FixMyStreet::App->model('DB::Alert')->create(
+ my $alert = FixMyStreet::DB->resultset('Alert')->create(
{
user => $user2,
alert_type => 'new_updates',
diff --git a/t/app/controller/admin/users.t b/t/app/controller/admin/users.t
index 95aac051d..e732f0edd 100644
--- a/t/app/controller/admin/users.t
+++ b/t/app/controller/admin/users.t
@@ -16,7 +16,7 @@ my $southend = $mech->create_body_ok(2607, 'Southend-on-Sea Borough Council');
$mech->log_in_ok( $superuser->email );
subtest 'search abuse' => sub {
- my $abuse = FixMyStreet::App->model('DB::Abuse')->find_or_create( { email => $user->email } );
+ my $abuse = FixMyStreet::DB->resultset('Abuse')->find_or_create( { email => $user->email } );
$mech->get_ok( '/admin/users?search=example' );
$mech->content_like(qr{test\@example.com.*</td>\s*<td>.*?</td>\s*<td>User in abuse table}s);
};
@@ -27,26 +27,26 @@ subtest 'remove user from abuse list from edit user page' => sub {
$mech->click_ok('unban');
- my $abuse = FixMyStreet::App->model('DB::Abuse')->find( { email => $user->email } );
+ my $abuse = FixMyStreet::DB->resultset('Abuse')->find( { email => $user->email } );
ok !$abuse, 'record removed from abuse table';
};
subtest 'remove user with phone account from abuse list from edit user page' => sub {
my $abuse_user = $mech->create_user_ok('01234 456789');
- my $abuse = FixMyStreet::App->model('DB::Abuse')->find_or_create( { email => $abuse_user->phone } );
+ my $abuse = FixMyStreet::DB->resultset('Abuse')->find_or_create( { email => $abuse_user->phone } );
$mech->get_ok( '/admin/users/' . $abuse_user->id );
$mech->content_contains('User in abuse table');
- my $abuse_found = FixMyStreet::App->model('DB::Abuse')->find( { email => $abuse_user->phone } );
+ my $abuse_found = FixMyStreet::DB->resultset('Abuse')->find( { email => $abuse_user->phone } );
ok $abuse_found, 'user in abuse table';
$mech->click_ok('unban');
- $abuse = FixMyStreet::App->model('DB::Abuse')->find( { email => $user->phone } );
+ $abuse = FixMyStreet::DB->resultset('Abuse')->find( { email => $user->phone } );
ok !$abuse, 'record removed from abuse table';
};
subtest 'no option to remove user already in abuse list' => sub {
- my $abuse = FixMyStreet::App->model('DB::Abuse')->find( { email => $user->email } );
+ my $abuse = FixMyStreet::DB->resultset('Abuse')->find( { email => $user->email } );
$abuse->delete if $abuse;
$mech->get_ok( '/admin/users/' . $user->id );
$mech->content_lacks('User in abuse table');