From 7c25ecccfdce93a88595d50f1f3fa891a7c850e5 Mon Sep 17 00:00:00 2001 From: Finn Date: Thu, 24 Aug 2017 12:48:32 +0100 Subject: [PATCH] Entry field and test fixed --- t/admin/user.t | 52 ++++++++++++++++++++---------- templates/admin/users/read.html.ep | 2 +- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/t/admin/user.t b/t/admin/user.t index 86386e0..a531600 100644 --- a/t/admin/user.t +++ b/t/admin/user.t @@ -51,15 +51,43 @@ $t->post_ok('/admin', form => { })->status_is(200); #Read customer user -$t->get_ok('/admin/users/1/') - ->status_is(200); - -#Read organisation user $t->get_ok('/admin/users/2/') ->status_is(200); +#Read organisation user +$t->get_ok('/admin/users/3/') + ->status_is(200); + +#Valid customer user update +$t->post_ok('/admin/users/2/edit', form => { + email => 'test12@example.com', + new_password => 'abc123', + full_name => 'Test User1', + display_name => 'Test User1', + town => 'Midgar', + postcode => 'WC1E 6AD', +})->status_is(200)->content_like(qr/Updated User/); + +#Failed validation on customer user from no postcode +$t->post_ok('/admin/users/2/edit', form => { + email => 'test12@example.com', + new_password => 'abc123', + full_name => 'Test User1', + display_name => 'Test User1', + town => 'Midgar', +})->content_like(qr/The validation has failed/); + +#Failed validation on customer user from no display name +$t->post_ok('/admin/users/2/edit', form => { + email => 'test12@example.com', + new_password => 'abc123', + full_name => 'Test User1', + town => 'Midgar', + postcode => 'WC1E 6AD', +})->content_like(qr/The validation has failed/); + #Valid organisation user update -$t->post_ok('/admin/users/1/edit', form => { +$t->post_ok('/admin/users/3/edit', form => { email => 'test51@example.com', new_password => 'abc123', name => '7th Heaven', @@ -68,18 +96,8 @@ $t->post_ok('/admin/users/1/edit', form => { postcode => 'WC1E 6AD', })->status_is(200)->content_like(qr/Updated User/); -#Failed validation on organisation user from wrong email -$t->post_ok('/admin/users/1/edit', form => { - email => 'test55@example.com', - new_password => 'abc123', - name => '7th Heaven', - street_name => 'Slums, Sector 7', - town => 'Midgar', - postcode => 'WC1E 6AD', -})->content_like(qr/The validation has failed/); - #Failed validation on organisation user from no postcode -$t->post_ok('/admin/users/1/edit', form => { +$t->post_ok('/admin/users/3/edit', form => { email => 'test50@example.com', new_password => 'abc123', name => '7th Heaven', @@ -88,7 +106,7 @@ $t->post_ok('/admin/users/1/edit', form => { })->content_like(qr/The validation has failed/); #Failed validation on organisation user from no street name -$t->post_ok('/admin/users/1/edit', form => { +$t->post_ok('/admin/users/3/edit', form => { email => 'test50@example.com', new_password => 'abc123', name => '7th Heaven', diff --git a/templates/admin/users/read.html.ep b/templates/admin/users/read.html.ep index 9cf6740..c0463c3 100644 --- a/templates/admin/users/read.html.ep +++ b/templates/admin/users/read.html.ep @@ -49,7 +49,7 @@
- +
% } elsif ( my $org_rs = $user->organisation ) {