aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-06-21 17:56:32 +0100
committerStruan Donald <struan@exo.org.uk>2011-06-21 17:56:32 +0100
commit8e78cc8816f2f1a91660a2908f0c4b47712b55b0 (patch)
treec098f0fe504bd7f646e8c6aaea8647a527e72861 /t/app/controller
parentddde474e6a1dfb1591e8cfe06dc05c8be3312853 (diff)
parent62887757a6b8a94047911a90b44e6bf12776b08d (diff)
Merge branch 'master' of ssh://git.mysociety.org/data/git/public/fixmystreet into new_statuses
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/admin.t24
-rw-r--r--t/app/controller/auth.t9
2 files changed, 24 insertions, 9 deletions
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t
index 74fb4ae33..60cbd6937 100644
--- a/t/app/controller/admin.t
+++ b/t/app/controller/admin.t
@@ -136,18 +136,17 @@ subtest 'check summary counts' => sub {
$mech->get_ok('/admin/council_contacts/2650');
$mech->content_contains('Aberdeen City Council');
$mech->content_contains('AB15 8RN');
+$mech->content_contains('street.com/around');
subtest 'check contact creation' => sub {
- my $contact = FixMyStreet::App->model('DB::Contact')->find(
- { area_id => 2650, category => 'test category' }
+ my $contact = FixMyStreet::App->model('DB::Contact')->search(
+ { area_id => 2650, category => [ 'test category', 'test/category' ] }
);
-
- $contact->delete if $contact;
+ $contact->delete_all;
my $history = FixMyStreet::App->model('DB::ContactsHistory')->search(
- { area_id => 2650, category => 'test category' }
+ { area_id => 2650, category => [ 'test category', 'test/category' ] }
);
-
$history->delete_all;
$mech->get_ok('/admin/council_contacts/2650');
@@ -161,6 +160,14 @@ subtest 'check contact creation' => sub {
$mech->content_contains( 'test category' );
$mech->content_contains( '<td>test@example.com' );
$mech->content_contains( '<td>test note' );
+
+ $mech->submit_form_ok( { with_fields => {
+ category => 'test/category',
+ email => 'test@example.com',
+ note => 'test/note',
+ } } );
+ $mech->get_ok('/admin/council_edit/2650/test/category');
+
};
subtest 'check contact editing' => sub {
@@ -194,6 +201,11 @@ subtest 'check contact updating' => sub {
$mech->content_like(qr{test2\@example.com[^<]*</td>[^<]*<td><strong>Yes}s);
};
+subtest 'check text output' => sub {
+ $mech->get_ok('/admin/council_contacts/2650?text=1');
+ is $mech->content_type, 'text/plain';
+ $mech->content_contains('test category');
+};
my $log_entries = FixMyStreet::App->model('DB::AdminLog')->search(
{
diff --git a/t/app/controller/auth.t b/t/app/controller/auth.t
index a44716a1e..79db69704 100644
--- a/t/app/controller/auth.t
+++ b/t/app/controller/auth.t
@@ -57,7 +57,6 @@ $mech->submit_form_ok(
},
"create an account for '$test_email'"
);
-is $mech->uri->path, '/auth/token', "redirected to welcome page";
# check that we are not logged in yet
$mech->not_logged_in_ok;
@@ -108,12 +107,14 @@ $mech->not_logged_in_ok;
$mech->submit_form_ok(
{
form_name => 'general_auth',
- fields => { email => "$test_email", },
+ fields => {
+ email => "$test_email",
+ r => 'faq', # Just as a test
+ },
button => 'email_login',
},
"email_login with '$test_email'"
);
- is $mech->uri->path, '/auth/token', "redirected to token page";
# rest is as before so no need to test
@@ -125,7 +126,9 @@ $mech->not_logged_in_ok;
$mech->clear_emails_ok;
my ($link) = $email->body =~ m{(http://\S+)};
$mech->get_ok($link);
+ is $mech->uri->path, '/faq', "redirected to the Help page";
+ $mech->get_ok('/my');
$mech->follow_link_ok( { url => '/auth/change_password' } );
ok my $form = $mech->form_name('change_password'),