parent
a6fc1a5705
commit
00d25f3664
3 changed files with 94 additions and 0 deletions
@ -0,0 +1,32 @@ |
||||
#!/usr/bin/env perl |
||||
use MJB::Web::Test; |
||||
|
||||
#== |
||||
# Test to ensure that the blog index page redirects to the page for |
||||
# creating the blog on a hosted page. |
||||
#== |
||||
|
||||
my $t = Test::Mojo::MJB->new('MJB::Web'); |
||||
|
||||
# Ensure that a user who hasn't logged in cannot access this page. |
||||
$t->get_ok( '/blog' ) |
||||
->status_is( 302 ) |
||||
->header_is( location => '/login' ); |
||||
|
||||
# Make sure that open registration method is enabled and create a user account. |
||||
$t->app->config->{register}{enable_open} = 1; |
||||
$t->post_ok( '/register/open', form => { |
||||
name => 'fred', |
||||
email => 'fred@blog.com', |
||||
password => 'SuperSecure', |
||||
password_confirm => 'SuperSecure', |
||||
}) |
||||
->status_is( 302 ) |
||||
->get_ok( '/' ); |
||||
|
||||
# Confirm the blog index page redirects to the create blog hosted page. |
||||
$t->get_ok( '/blog' ) |
||||
->status_is( 302 ) |
||||
->header_is( location => '/blog/domain/hosted' ); |
||||
|
||||
done_testing(); |
||||
@ -0,0 +1,31 @@ |
||||
#!/usr/bin/env perl |
||||
use MJB::Web::Test; |
||||
|
||||
#== |
||||
# Ensure that the route for creating a blog on a hosted domain behaves |
||||
# as expected. Anonymouse users should be dismissed to the login page. |
||||
#== |
||||
|
||||
my $t = Test::Mojo::MJB->new('MJB::Web'); |
||||
|
||||
# Ensure that a user who hasn't logged in cannot access this page. |
||||
$t->get_ok( '/blog/domain/hosted' ) |
||||
->status_is( 302 ) |
||||
->header_is( location => '/login' ); |
||||
|
||||
# Make sure that open registration method is enabled and create a user account. |
||||
$t->app->config->{register}{enable_open} = 1; |
||||
$t->post_ok( '/register/open', form => { |
||||
name => 'fred', |
||||
email => 'fred@blog.com', |
||||
password => 'SuperSecure', |
||||
password_confirm => 'SuperSecure', |
||||
}) |
||||
->status_is( 302 ) |
||||
->get_ok( '/' ); |
||||
|
||||
# Confirm that the page exists and is served. |
||||
$t->get_ok( '/blog/domain/hosted' ) |
||||
->status_is( 200 ); |
||||
|
||||
done_testing(); |
||||
@ -0,0 +1,31 @@ |
||||
#!/usr/bin/env perl |
||||
use MJB::Web::Test; |
||||
|
||||
#== |
||||
# Ensure that the route for creating a blog on an owned domain behaves |
||||
# as expected. Anonymouse users should be dismissed to the login page. |
||||
#== |
||||
|
||||
my $t = Test::Mojo::MJB->new('MJB::Web'); |
||||
|
||||
# Ensure that a user who hasn't logged in cannot access this page. |
||||
$t->get_ok( '/blog/domain/owned' ) |
||||
->status_is( 302 ) |
||||
->header_is( location => '/login' ); |
||||
|
||||
# Make sure that open registration method is enabled and create a user account. |
||||
$t->app->config->{register}{enable_open} = 1; |
||||
$t->post_ok( '/register/open', form => { |
||||
name => 'fred', |
||||
email => 'fred@blog.com', |
||||
password => 'SuperSecure', |
||||
password_confirm => 'SuperSecure', |
||||
}) |
||||
->status_is( 302 ) |
||||
->get_ok( '/' ); |
||||
|
||||
# Confirm that the page exists and is served. |
||||
$t->get_ok( '/blog/domain/owned' ) |
||||
->status_is( 200 ); |
||||
|
||||
done_testing(); |
||||
Loading…
Reference in new issue