aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/model
diff options
context:
space:
mode:
Diffstat (limited to 't/app/model')
-rw-r--r--t/app/model/alert_type.t38
-rw-r--r--t/app/model/defecttype.t15
-rw-r--r--t/app/model/extra.t72
-rw-r--r--t/app/model/problem.t17
-rw-r--r--t/app/model/responsepriority.t17
-rw-r--r--t/app/model/responsetemplate.t2
-rw-r--r--t/app/model/session.t4
-rw-r--r--t/app/model/state.t8
-rw-r--r--t/app/model/user.t43
9 files changed, 159 insertions, 57 deletions
diff --git a/t/app/model/alert_type.t b/t/app/model/alert_type.t
index 124e838ee..42bed37eb 100644
--- a/t/app/model/alert_type.t
+++ b/t/app/model/alert_type.t
@@ -1,3 +1,4 @@
+use utf8;
use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new();
@@ -253,7 +254,7 @@ $report->geocode(
'estimatedTotal' => 1
}
],
- 'copyright' => "Copyright \x{a9} 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.",
+ 'copyright' => "Copyright © 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.",
'statusCode' => 200,
'authenticationResultCode' => 'ValidCredentials'
}
@@ -336,6 +337,8 @@ foreach my $test (
};
}
+my $hart = $mech->create_body_ok(2333, 'Hart');
+
my $ward_alert = FixMyStreet::DB->resultset('Alert')->find_or_create(
{
user => $user,
@@ -350,7 +353,7 @@ my $ward_alert = FixMyStreet::DB->resultset('Alert')->find_or_create(
my $report_to_council = FixMyStreet::DB->resultset('Problem')->find_or_create(
{
postcode => 'WS13 6YY',
- bodies_str => '2434',
+ bodies_str => $hart->id,
areas => ',105255,11806,11828,2247,2504,7117,',
category => 'Other',
title => 'council report',
@@ -374,7 +377,7 @@ my $report_to_council = FixMyStreet::DB->resultset('Problem')->find_or_create(
my $report_to_county_council = FixMyStreet::DB->resultset('Problem')->find_or_create(
{
postcode => 'WS13 6YY',
- bodies_str => '2240',
+ bodies_str => '2227',
areas => ',105255,11806,11828,2247,2504,7117,',
category => 'Other',
title => 'county report',
@@ -429,21 +432,22 @@ subtest "check alerts from cobrand send main site url for alerts for different c
)->delete;
FixMyStreet::override_config {
+ ALLOWED_COBRANDS => ['hart', 'fixmystreet'],
+ BASE_URL => 'https://national.example.org',
MAPIT_URL => 'http://mapit.uk/',
}, sub {
FixMyStreet::DB->resultset('AlertType')->email_alerts();
- };
-
- my $body = $mech->get_text_body_from_email;
- my $expected1 = FixMyStreet->config('BASE_URL') . '/report/' . $report_to_county_council->id;
- my $expected3 = FixMyStreet->config('BASE_URL') . '/report/' . $report_outside_district->id;
- my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('hart')->new();
- my $expected2 = $cobrand->base_url . '/report/' . $report_to_council->id;
+ my $body = $mech->get_text_body_from_email;
- like $body, qr#$expected1#, 'non cobrand area report point to fixmystreet.com';
- like $body, qr#$expected2#, 'cobrand area report point to cobrand url';
- like $body, qr#$expected3#, 'report outside district report point to fixmystreet.com';
+ my $expected1 = FixMyStreet->config('BASE_URL') . '/report/' . $report_to_county_council->id;
+ my $expected3 = FixMyStreet->config('BASE_URL') . '/report/' . $report_outside_district->id;
+ my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('hart')->new();
+ my $expected2 = $cobrand->base_url . '/report/' . $report_to_council->id;
+ like $body, qr#$expected1#, 'non cobrand area report point to fixmystreet.com';
+ like $body, qr#$expected2#, 'cobrand area report point to cobrand url';
+ like $body, qr#$expected3#, 'report outside district report point to fixmystreet.com';
+ };
};
@@ -485,7 +489,7 @@ subtest "correct i18n-ed summary for state of closed" => sub {
$mech->clear_emails_ok;
$report->update( { state => 'closed' } );
- $alert->update( { lang => 'nb', cobrand => 'fiksgatami' } );
+ $alert->update( { lang => 'sv', cobrand => 'fixamingata' } );
FixMyStreet::DB->resultset('AlertSent')->search( {
alert_id => $alert->id,
@@ -493,14 +497,14 @@ subtest "correct i18n-ed summary for state of closed" => sub {
} )->delete;
FixMyStreet::override_config {
- ALLOWED_COBRANDS => [ 'fiksgatami' ],
+ ALLOWED_COBRANDS => [ 'fixamingata' ],
}, sub {
FixMyStreet::DB->resultset('AlertType')->email_alerts();
};
my $body = $mech->get_text_body_from_email;
- my $msg = 'Denne rapporten er for tiden markert som lukket';
- like $body, qr/$msg/, 'email says problem is closed, in Norwegian';
+ my $msg = 'Den här rapporten är markerad som stängd';
+ like $body, qr/$msg/, 'email says problem is closed, in Swedish';
};
END {
diff --git a/t/app/model/defecttype.t b/t/app/model/defecttype.t
index e924129e2..3f1cc09b5 100644
--- a/t/app/model/defecttype.t
+++ b/t/app/model/defecttype.t
@@ -1,4 +1,3 @@
-use FixMyStreet::App;
use FixMyStreet::TestMech;
use JSON::MaybeXS;
@@ -11,7 +10,7 @@ my $potholes_contact = $mech->create_contact_ok( body_id => $oxfordshire->id, ca
my $traffic_lights_contact =$mech->create_contact_ok( body_id => $oxfordshire->id, category => 'Traffic lights', email => 'lights@example.com' );
my $pavements_contact =$mech->create_contact_ok( body_id => $oxfordshire->id, category => 'Pavements', email => 'pavements@example.com' );
-my $potholes_defect_type = FixMyStreet::App->model('DB::DefectType')->find_or_create(
+my $potholes_defect_type = FixMyStreet::DB->resultset('DefectType')->find_or_create(
{
body_id => $oxfordshire->id,
name => 'Potholes and Pavements',
@@ -27,7 +26,7 @@ $potholes_defect_type->contact_defect_types->find_or_create({
});
$potholes_defect_type->update();
-my $general_defect_type = FixMyStreet::App->model('DB::DefectType')->find_or_create(
+my $general_defect_type = FixMyStreet::DB->resultset('DefectType')->find_or_create(
{
body_id => $oxfordshire->id,
name => 'All categories',
@@ -37,14 +36,14 @@ my $general_defect_type = FixMyStreet::App->model('DB::DefectType')->find_or_cre
subtest 'for_bodies returns correct results' => sub {
- my $defect_types = FixMyStreet::App->model('DB::DefectType')->for_bodies(
+ my $defect_types = FixMyStreet::DB->resultset('DefectType')->for_bodies(
[ $oxfordshire->id ],
'Potholes'
);
is $defect_types->count, 2, 'Both defect types are included for Potholes category';
- $defect_types = FixMyStreet::App->model('DB::DefectType')->for_bodies(
+ $defect_types = FixMyStreet::DB->resultset('DefectType')->for_bodies(
[ $oxfordshire->id ],
'Traffic lights'
);
@@ -67,7 +66,7 @@ subtest 'Problem->defect_types behaves correctly' => sub {
subtest 'by_categories returns all defect types grouped by category' => sub {
my @contacts = FixMyStreet::DB->resultset('Contact')->not_deleted->search( { body_id => [ $oxfordshire->id ] } )->all;
- my $defect_types = FixMyStreet::App->model('DB::DefectType')->by_categories($area_id, @contacts);
+ my $defect_types = FixMyStreet::DB->resultset('DefectType')->by_categories(\@contacts, body_id => $oxfordshire->id);
my $potholes = decode_json($defect_types->{Potholes});
my $traffic_lights = decode_json($defect_types->{'Traffic lights'});
my $pavements = decode_json($defect_types->{Pavements});
@@ -80,7 +79,7 @@ subtest 'by_categories returns all defect types grouped by category' => sub {
};
subtest 'by_categories returns defect types for an area with multiple bodies' => sub {
- FixMyStreet::App->model('DB::DefectType')->find_or_create(
+ FixMyStreet::DB->resultset('DefectType')->find_or_create(
{
body_id => $other_body->id,
name => 'All categories',
@@ -89,7 +88,7 @@ subtest 'by_categories returns defect types for an area with multiple bodies' =>
);
my @contacts = FixMyStreet::DB->resultset('Contact')->not_deleted->search( { body_id => [ $oxfordshire->id ] } )->all;
- my $defect_types = FixMyStreet::App->model('DB::DefectType')->by_categories($area_id, @contacts);
+ my $defect_types = FixMyStreet::DB->resultset('DefectType')->by_categories(\@contacts, area_id => $area_id);
my $potholes = decode_json($defect_types->{Potholes});
my $traffic_lights = decode_json($defect_types->{'Traffic lights'});
my $pavements = decode_json($defect_types->{Pavements});
diff --git a/t/app/model/extra.t b/t/app/model/extra.t
index 55accb086..9adfb8f80 100644
--- a/t/app/model/extra.t
+++ b/t/app/model/extra.t
@@ -79,6 +79,31 @@ subtest 'Default hash layout' => sub {
is_deeply $contact->extra, { _fields => \@fields }, '(sanity check layout)';
};
+ subtest 'updating extra field' => sub {
+ my $contact = get_test_contact();
+ my @fields = ( { code => 'ABC', description => 'ABC', variable => 'false', }, { code => 'DEF', description => 'DEF', variable => 'true' } );
+ $contact->set_extra_fields(@fields);
+ is_deeply $contact->get_extra_fields, \@fields, 'extra fields set...';
+ my $new_field = { code => 'ABC', description => 'XYZ', variable => 'false' };
+ $contact->update_extra_field($new_field);
+ $fields[0] = $new_field;
+ is_deeply $contact->get_extra_fields, \@fields, 'extra fields changed';
+ $new_field = { code => 'GHI', description => 'GHI', variable => 'false' };
+ $contact->update_extra_field($new_field);
+ push @fields, $new_field;
+ is_deeply $contact->get_extra_fields, \@fields, 'extra fields changed';
+ };
+
+ subtest 'removing extra field' => sub {
+ my $contact = get_test_contact();
+ my @fields = ( { code => 'ABC', description => 'ABC', variable => 'false', }, { code => 'DEF', description => 'DEF', variable => 'true' } );
+ $contact->set_extra_fields(@fields);
+ is_deeply $contact->get_extra_fields, \@fields, 'extra fields set...';
+ $contact->remove_extra_field('DEF');
+ pop @fields;
+ is_deeply $contact->get_extra_fields(), \@fields, 'extra field removed';
+ };
+
subtest 'metadata' => sub {
my $contact = get_test_contact();
is_deeply $contact->get_extra_metadata, {}, 'No extra metadata';
@@ -139,6 +164,53 @@ subtest 'Get named field values' => sub {
is $report->get_extra_field_value("field1"), "value 1", "field1 has correct value";
is $report->get_extra_field_value("field 2"), "this is a test value", "field 2 has correct value";
+
+$report->delete;
+$user->delete;
+};
+
+subtest 'Get named fields' => sub {
+ my $user = $db->resultset('User')->create({
+ email => 'test-moderation@example.com',
+ email_verified => 1,
+ name => 'Test User'
+ });
+ my $report = $db->resultset('Problem')->create(
+ {
+ postcode => 'BR1 3SB',
+ bodies_str => "",
+ areas => "",
+ category => 'Other',
+ title => 'Good bad good',
+ detail => 'Good bad bad bad good bad',
+ used_map => 't',
+ name => 'Test User 2',
+ anonymous => 'f',
+ state => 'confirmed',
+ lang => 'en-gb',
+ service => '',
+ cobrand => 'default',
+ latitude => '51.4129',
+ longitude => '0.007831',
+ user_id => $user->id,
+ });
+
+ my @fields = ({
+ name => "field1",
+ description => "This is a test field",
+ value => "value 1",
+ },
+ {
+ code => "field 2",
+ description => "Another test",
+ value => "this is a test value",
+ });
+
+ $report->push_extra_fields(@fields);
+
+ is_deeply $report->get_extra_field(name => "field1"), $fields[0], "field1 has correct value";
+ is_deeply $report->get_extra_field(code => "field 2"), $fields[1], "field 2 has correct value";
+ is $report->get_extra_field(name => "field 2"), undef, "returns undef if no match";
};
done_testing();
diff --git a/t/app/model/problem.t b/t/app/model/problem.t
index 503fa9276..661a8827f 100644
--- a/t/app/model/problem.t
+++ b/t/app/model/problem.t
@@ -1,6 +1,5 @@
use FixMyStreet::TestMech;
use FixMyStreet;
-use FixMyStreet::App;
use FixMyStreet::DB;
use FixMyStreet::Script::Reports;
use Sub::Override;
@@ -106,15 +105,6 @@ for my $test (
}
},
{
- desc => 'bad category',
- changed => {
- category => '-- Pick a category --',
- },
- errors => {
- category => 'Please choose a category',
- }
- },
- {
desc => 'correct category',
changed => {
category => 'Horse!',
@@ -625,6 +615,8 @@ subtest 'check can set multiple emails as a single contact' => sub {
FixMyStreet::Script::Reports::send();
};
+ $problem->discard_changes;
+ is_deeply $problem->get_extra_metadata('sent_to'), [ '2636@example.com', '2636-2@example.com' ];
$mech->email_count_is(1);
my $email = $mech->get_email;
is $email->header('To'), '"City of Edinburgh Council" <2636@example.com>, "City of Edinburgh Council" <2636-2@example.com>', 'To contains two email addresses';
@@ -671,6 +663,7 @@ subtest 'check can turn on report sent email alerts' => sub {
$problem->discard_changes;
ok defined( $problem->whensent ), 'whensent set';
+ is_deeply $problem->get_extra_metadata('sent_to'), [ 'test@example.org' ];
$email = $emails[1];
like $email->header('Subject'), qr/FixMyStreet Report Sent/, 'report sent email title correct';
@@ -791,7 +784,7 @@ subtest 'generates a tokenised url for a user' => sub {
like $url, qr/\/M\//, 'problem generates tokenised url';
- my $token_obj = FixMyStreet::App->model('DB::Token')->find( {
+ my $token_obj = FixMyStreet::DB->resultset('Token')->find( {
scope => 'email_sign_in', token => $token
} );
is $token, $token_obj->token, 'token is generated in database with correct scope';
@@ -803,7 +796,7 @@ subtest 'stores params in a token' => sub {
my $url = $problem->tokenised_url($user, { foo => 'bar', baz => 'boo'});
(my $token = $url) =~ s/\/M\///g;
- my $token_obj = FixMyStreet::App->model('DB::Token')->find( {
+ my $token_obj = FixMyStreet::DB->resultset('Token')->find( {
scope => 'email_sign_in', token => $token
} );
diff --git a/t/app/model/responsepriority.t b/t/app/model/responsepriority.t
index 4e624bf07..bd09c2da0 100644
--- a/t/app/model/responsepriority.t
+++ b/t/app/model/responsepriority.t
@@ -2,7 +2,6 @@ use strict;
use warnings;
use Test::More;
-use FixMyStreet::App;
use FixMyStreet::TestMech;
use JSON::MaybeXS;
@@ -14,7 +13,7 @@ my $other_body = $mech->create_body_ok($area_id, 'Some Other Council');
my $potholes_contact = $mech->create_contact_ok( body_id => $oxfordshire->id, category => 'Potholes', email => 'potholes@example.com' );
my $traffic_lights_contact =$mech->create_contact_ok( body_id => $oxfordshire->id, category => 'Traffic lights', email => 'lights@example.com' );
-my $potholes_response_priority = FixMyStreet::App->model('DB::ResponsePriority')->find_or_create(
+my $potholes_response_priority = FixMyStreet::DB->resultset('ResponsePriority')->find_or_create(
{
body_id => $oxfordshire->id,
name => 'Potholes',
@@ -25,7 +24,7 @@ $potholes_response_priority->contact_response_priorities->find_or_create({
contact_id => $potholes_contact->id,
});
-my $general_response_priority = FixMyStreet::App->model('DB::ResponsePriority')->find_or_create(
+my $general_response_priority = FixMyStreet::DB->resultset('ResponsePriority')->find_or_create(
{
body_id => $oxfordshire->id,
name => 'All categories',
@@ -34,14 +33,14 @@ my $general_response_priority = FixMyStreet::App->model('DB::ResponsePriority')-
);
subtest 'for_bodies returns correct results' => sub {
- my $priorities = FixMyStreet::App->model('DB::ResponsePriority')->for_bodies(
+ my $priorities = FixMyStreet::DB->resultset('ResponsePriority')->for_bodies(
[ $oxfordshire->id ],
'Potholes'
);
is $priorities->count, 2, 'Both priorities are included for Potholes category';
- $priorities = FixMyStreet::App->model('DB::ResponsePriority')->for_bodies(
+ $priorities = FixMyStreet::DB->resultset('ResponsePriority')->for_bodies(
[ $oxfordshire->id ],
'Traffic lights'
);
@@ -50,9 +49,9 @@ subtest 'for_bodies returns correct results' => sub {
is $priorities->first->name, $general_response_priority->name, 'Correct priority is returned for Traffic lights category';
};
-subtest 'by_categories returns allresponse priorities grouped by category' => sub {
+subtest 'by_categories returns all response priorities grouped by category' => sub {
my @contacts = FixMyStreet::DB->resultset('Contact')->not_deleted->search( { body_id => [ $oxfordshire->id ] } )->all;
- my $priorities = FixMyStreet::App->model('DB::ResponsePriority')->by_categories($area_id, @contacts);
+ my $priorities = FixMyStreet::DB->resultset('ResponsePriority')->by_categories(\@contacts, body_id => $oxfordshire->id);
my $potholes = decode_json($priorities->{Potholes});
my $traffic_lights = decode_json($priorities->{'Traffic lights'});
@@ -61,7 +60,7 @@ subtest 'by_categories returns allresponse priorities grouped by category' => su
};
subtest 'by_categories returns all response priorities for an area with multiple bodies' => sub {
- my $other_response_priority = FixMyStreet::App->model('DB::ResponsePriority')->find_or_create(
+ my $other_response_priority = FixMyStreet::DB->resultset('ResponsePriority')->find_or_create(
{
body_id => $other_body->id,
name => 'All categories',
@@ -70,7 +69,7 @@ subtest 'by_categories returns all response priorities for an area with multiple
);
my @contacts = FixMyStreet::DB->resultset('Contact')->not_deleted->search( { body_id => [ $oxfordshire->id ] } )->all;
- my $priorities = FixMyStreet::App->model('DB::ResponsePriority')->by_categories($area_id, @contacts);
+ my $priorities = FixMyStreet::DB->resultset('ResponsePriority')->by_categories(\@contacts, area_id => $area_id);
my $potholes = decode_json($priorities->{Potholes});
my $traffic_lights = decode_json($priorities->{'Traffic lights'});
diff --git a/t/app/model/responsetemplate.t b/t/app/model/responsetemplate.t
index fbabc1c12..9efc7e3b4 100644
--- a/t/app/model/responsetemplate.t
+++ b/t/app/model/responsetemplate.t
@@ -16,7 +16,7 @@ $t2->add_to_contacts($c2);
my @contacts = FixMyStreet::DB->resultset('Contact')->not_deleted->search( { body_id => [ $body->id ] } )->all;
subtest 'by_categories returns allresponse templates grouped by category' => sub {
- my $templates = FixMyStreet::App->model('DB::ResponseTemplate')->by_categories($area_id, @contacts);
+ my $templates = FixMyStreet::DB->resultset('ResponseTemplate')->by_categories(\@contacts, body_id => $body->id);
my $potholes = decode_json($templates->{Potholes});
my $graffiti = decode_json($templates->{Graffiti});
diff --git a/t/app/model/session.t b/t/app/model/session.t
index f76533727..f460204e5 100644
--- a/t/app/model/session.t
+++ b/t/app/model/session.t
@@ -2,13 +2,13 @@ use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;
-$mech->log_in_ok('test@example.com');
+my $user = $mech->log_in_ok('test@example.com');
my $session = FixMyStreet::DB->resultset("Session")->first;
my $id = $session->id;
$id =~ s/\s+$//;
is $id, "session:" . $session->id_code;
-is $session->user->email, 'test@example.com';
+is $session->user->email, $user->email;
done_testing;
diff --git a/t/app/model/state.t b/t/app/model/state.t
index 35f3d4fb3..f680cf3e8 100644
--- a/t/app/model/state.t
+++ b/t/app/model/state.t
@@ -66,14 +66,14 @@ is_deeply [ sort FixMyStreet::DB::Result::Problem->fixed_states ],
['fixed', 'fixed - council', 'fixed - user'], 'fixed states okay';
FixMyStreet::override_config {
- LANGUAGES => [ 'en-gb,English,en_GB', 'nb,Norwegian,nb_NO' ],
+ LANGUAGES => [ 'en-gb,English,en_GB', 'sv,Swedish,sv_SE' ],
}, sub {
subtest 'translation of open works both ways (file/db)' => sub {
# Note at this point the states have been cached
my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('default')->new;
- my $lang = $cobrand->set_lang_and_domain('nb', 1, FixMyStreet->path_to('locale')->stringify);
- is $lang, 'nb';
- is $rs->display('confirmed'), "Åpen";
+ my $lang = $cobrand->set_lang_and_domain('sv', 1, FixMyStreet->path_to('locale')->stringify);
+ is $lang, 'sv';
+ is $rs->display('confirmed'), "Öppen";
$lang = $cobrand->set_lang_and_domain('en-gb', 1, FixMyStreet->path_to('locale')->stringify);
is $lang, 'en-gb';
is $rs->display('confirmed'), "Open Eng trans";
diff --git a/t/app/model/user.t b/t/app/model/user.t
index 5a9c898a2..929020d4b 100644
--- a/t/app/model/user.t
+++ b/t/app/model/user.t
@@ -1,5 +1,8 @@
use FixMyStreet::TestMech;
use FixMyStreet::DB;
+use Catalyst::Test 'FixMyStreet::App';
+use HTTP::Request::Common;
+use Test::Exception;
my $mech = FixMyStreet::TestMech->new();
$mech->log_in_ok('test@example.com');
@@ -63,14 +66,46 @@ FixMyStreet::override_config {
$mech->content_like(qr/may_show_name[^>c]*>/);
};
-END {
- done_testing();
-}
+subtest 'Check non-existent methods on user object die' => sub {
+ my $c = ctx_request(POST '/auth', { username => $problem->user->email, password_sign_in => 'secret' });
+ throws_ok(
+ sub { $c->user->is_super_user },
+ qr/Can't locate object method 'is_super_user'/,
+ 'attempt to call non-existent method'
+ );
+};
+
+subtest 'OIDC ids can be manipulated correctly' => sub {
+ my $user = $problem->user;
+
+ is $user->oidc_ids, undef, 'user starts with no OIDC ids';
+
+ $user->add_oidc_id("fixmystreet:1234:5678");
+ is_deeply $user->oidc_ids, ["fixmystreet:1234:5678"], 'OIDC id added correctly';
+
+ $user->add_oidc_id("mycobrand:0123:abcd");
+ is_deeply [ sort @{$user->oidc_ids} ], ["fixmystreet:1234:5678", "mycobrand:0123:abcd"], 'Second OIDC id added correctly';
+
+ $user->add_oidc_id("mycobrand:0123:abcd");
+ is_deeply [ sort @{$user->oidc_ids} ], ["fixmystreet:1234:5678", "mycobrand:0123:abcd"], 'Adding existing OIDC id does not add duplicate';
+
+ $user->remove_oidc_id("mycobrand:0123:abcd");
+ is_deeply $user->oidc_ids, ["fixmystreet:1234:5678"], 'OIDC id can be removed OK';
+
+ $user->remove_oidc_id("mycobrand:0123:abcd");
+ is_deeply $user->oidc_ids, ["fixmystreet:1234:5678"], 'Removing non-existent OIDC id has no effect';
+
+ $user->remove_oidc_id("fixmystreet:1234:5678");
+ is $user->oidc_ids, undef, 'Removing last OIDC id results in undef';
+
+};
+
+done_testing();
sub create_update {
my ($problem, %params) = @_;
my $dt = DateTime->now()->add(days => 1);
- return FixMyStreet::App->model('DB::Comment')->find_or_create({
+ return FixMyStreet::DB->resultset('Comment')->find_or_create({
problem_id => $problem->id,
user_id => $problem->user_id,
name => 'Other User',