parent
4009b42814
commit
a71c365fa5
2 changed files with 97 additions and 0 deletions
@ -0,0 +1,41 @@ |
|||||||
|
#!/usr/bin/env perl |
||||||
|
use MJB::Web::Test; |
||||||
|
|
||||||
|
#== |
||||||
|
# This test ensures that a blog can be created with an owned domain. |
||||||
|
# |
||||||
|
# A user account will be registered, and the user will create a blog on |
||||||
|
# blog.example.com, and then it will be confirmed that a blog exists with its |
||||||
|
# index page. |
||||||
|
# |
||||||
|
# Note: During testing ->jekyll uses an alternative root path to store repos at. |
||||||
|
# When using ->jekyll in tests, you MUST call $t->clear_tempdir when you are |
||||||
|
# done testing to remove the altrernative jekyll root. |
||||||
|
#== |
||||||
|
|
||||||
|
my $t = Test::Mojo::MJB->new('MJB::Web'); |
||||||
|
|
||||||
|
# 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 ); |
||||||
|
|
||||||
|
# Create a blog.... |
||||||
|
$t->post_ok( '/blog/domain', form => { |
||||||
|
domain => 'blog.example.com', |
||||||
|
calling_route => 'show_blog_domain_owned', |
||||||
|
}); |
||||||
|
|
||||||
|
# See if we have the blog directory and index.markdown file. |
||||||
|
ok -f $t->app->jekyll( 'blog.example.com' )->root . '/blog.example.com/index.markdown', |
||||||
|
'Have an index file for the blog!'; |
||||||
|
|
||||||
|
# Remove the alternative path. |
||||||
|
$t->clear_tempdir; |
||||||
|
|
||||||
|
done_testing; |
||||||
@ -0,0 +1,56 @@ |
|||||||
|
#!/usr/bin/env perl |
||||||
|
use MJB::Web::Test; |
||||||
|
|
||||||
|
#== |
||||||
|
# This test ensures that a blog can be created with a hosted domain. |
||||||
|
# |
||||||
|
# A user account will be registered, promoted to admin, and create a hosted |
||||||
|
# domain for 'example.com'. The user will then create a blog on |
||||||
|
# blog.example.com, and then it will be confirmed that a blog exists with its |
||||||
|
# index page. |
||||||
|
# |
||||||
|
# Note: During testing ->jekyll uses an alternative root path to store repos at. |
||||||
|
# When using ->jekyll in tests, you MUST call $t->clear_tempdir when you are |
||||||
|
# done testing to remove the altrernative jekyll root. |
||||||
|
#== |
||||||
|
|
||||||
|
my $t = Test::Mojo::MJB->new('MJB::Web'); |
||||||
|
|
||||||
|
# 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( '/' ) |
||||||
|
->code_block( sub { |
||||||
|
my $self = shift; |
||||||
|
$self->stash->{person}->is_admin( 1 ); |
||||||
|
ok( $self->stash->{person}->update, 'Promoted fred to an admin' ); |
||||||
|
}); |
||||||
|
|
||||||
|
# Add a hosted domain |
||||||
|
$t->post_ok( '/admin/domain', form => { |
||||||
|
domain_fqdn => 'example.com', |
||||||
|
ssl_challenge => 'http', |
||||||
|
}) |
||||||
|
->header_is( location => '/admin/domains' ); |
||||||
|
|
||||||
|
# Create a blog with the hosted domain method.... |
||||||
|
$t->post_ok( '/blog/domain', form => { |
||||||
|
hosted_subdomain => 'blog', |
||||||
|
hosted_domain_id => 1, |
||||||
|
calling_route => 'show_blog_domain_hosted', |
||||||
|
}); |
||||||
|
|
||||||
|
# See if we have the blog directory and index.markdown file. |
||||||
|
ok -f $t->app->jekyll( 'blog.example.com' )->root . '/blog.example.com/index.markdown', |
||||||
|
'Have an index file for the blog!'; |
||||||
|
|
||||||
|
# Remove the alternative path. |
||||||
|
$t->clear_tempdir; |
||||||
|
|
||||||
|
done_testing; |
||||||
Loading…
Reference in new issue