diff options
author | Jannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de> | 2020-11-03 16:51:08 +0100 |
---|---|---|
committer | Jannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de> | 2020-11-03 16:51:08 +0100 |
commit | 2e60e72c0af1e614a96d13df2c5b417733a78d46 (patch) | |
tree | 58e8987eb04ad7019d4aa543ddd6f7fb2b5e2529 | |
parent | 8fdd948d0e805d937e0325db1a096c774ffd1233 (diff) |
added language test; use subtests
-rw-r--r-- | t/Webmail.t | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/t/Webmail.t b/t/Webmail.t index 48406b9..5409f32 100644 --- a/t/Webmail.t +++ b/t/Webmail.t @@ -7,28 +7,31 @@ use Test::Mojo; use JWebmail::Model::Driver::Mock; + +use constant DEFAULT_LANGUAGE => 'en'; my $user = JWebmail::Model::Driver::Mock::VALID_USER; my $pw = JWebmail::Model::Driver::Mock::VALID_PW; + my $t = Test::Mojo->new('JWebmail', { - development => { use_read_mock => 1, block_writes => 1 }, + development => { use_read_mock => 1, block_writes => 1 }, + i18n => { default_language => 'en' }, }); $t->get_ok('/')->status_is(200); -$t->post_ok('/login', form => {userid => $user, password => 'x'}) - ->status_is(400); - -$t->post_ok('/login', form => {userid => $user, password => 'abcde'}) - ->status_is(401); +subtest login => sub { + $t->post_ok('/login', form => {userid => $user, password => 'x'})->status_is(400); + $t->post_ok('/login', form => {userid => $user, password => 'abcde'})->status_is(401); + $t->post_ok('/login', form => {userid => $user, password => $pw})->status_is(303); +}; -$t->post_ok('/login', form => {userid => $user, password => $pw}) - ->status_is(303); -done_testing(); +subtest lang => sub { + $t->get_ok('/about')->status_is(200)->attr_is('html', 'lang', DEFAULT_LANGUAGE); + $t->get_ok('/en/about')->status_is(200)->attr_is('html', 'lang', 'en'); + $t->get_ok('/de/about')->status_is(200)->attr_is('html', 'lang', 'de'); +}; -#$r->get('/123' => sub { my $c = shift; $c->render(inline => $c->stash->{lang}) }); -#my $x = $self->build_controller; -#$x->match->find($self, {method => 'GET', path => '//write'}); -#print $self->dumper($x->match->stack);
\ No newline at end of file +done_testing; |