From: Errietta Kostala Date: Mon, 26 Jan 2015 14:39:05 +0000 (+0000) Subject: Registration test X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2Fstemmaweb.git;a=commitdiff_plain;h=315022bd417c1b6ae20b516957dfdeeed9c898ff Registration test --- diff --git a/t/05register.t b/t/05register.t index 37ea333..28e3052 100644 --- a/t/05register.t +++ b/t/05register.t @@ -64,5 +64,33 @@ $response = $ua->submit_form( $ua->content_contains('That username already exists.', 'We cannot register an already existing username'); +$ua->get('/logout'); +$ua->get('http://localhost/register'); + +$ua->submit_form; + +$ua->content_contains('Your username is required.', 'We get an error if username is empty'); +$ua->content_contains('Your password is required.', 'We get an error if password is empty'); +$ua->content_contains('You must confirm your password.', 'We get an error if password confirmation is empty'); + +$ua->submit_form( + fields => { + username => 'new@example.com', + password => 'MyPassword', + confirm_password => 'WrongPassword', + }); + +$ua->content_contains('The password confirmation does not match the password', 'confirm password needs to be the same as password.'); + +$ua->submit_form( + fields => { + username => 'user', + password => 'a', + confirm_password => 'a', + }); + + +$ua->content_contains('Field must be at least 8 characters. You entered 1', 'Error is shown on too short passwd.'); + done_testing;