diff options
author | Jannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de> | 2022-05-09 11:56:15 +0200 |
---|---|---|
committer | Jannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de> | 2022-05-09 11:56:15 +0200 |
commit | 73503d87d3f9f87a73616bd3f4365906c87ae13e (patch) | |
tree | 5efb95a41f132d6a75fdb97401ef42467d9bca86 | |
parent | de941df4cb8ef4f95563ef818380f870f442f7cd (diff) |
fixes for tests and packageing
-rw-r--r-- | MANIFEST | 52 | ||||
-rw-r--r-- | Makefile.PL | 3 | ||||
-rwxr-xr-x | actions.sh | 14 | ||||
-rw-r--r-- | lib/JWebmail/Plugin/I18N2.pm | 8 | ||||
-rw-r--r-- | t/I18N2.t | 2 | ||||
-rw-r--r-- | t/Webmail.t | 7 |
6 files changed, 51 insertions, 35 deletions
@@ -1,37 +1,49 @@ -jwebmail.conf +script/jwebmail +script/qmauth.pl + lib/JWebmail.pm lib/JWebmail/Controller/Webmail.pm +lib/JWebmail/I18N.pm +lib/JWebmail/I18N/de.pm +lib/JWebmail/I18N/en.pm lib/JWebmail/Model/ReadMails/Role.pm lib/JWebmail/Model/ReadMails/MockMaildir.pm lib/JWebmail/Model/ReadMails/QMailAuthuser.pm lib/JWebmail/Model/WriteMails.pm lib/JWebmail/Plugin/Helper.pm -lib/JWebmail/Plugin/INIConfig.pm +lib/JWebmail/Plugin/TOMLConfig.pm lib/JWebmail/Plugin/I18N2.pm lib/JWebmail/Plugin/ServerSideSessionData.pm -README.md -LICENSE -lang/de.lang -lang/en.lang -Makefile.PL + t/Webmail.t t/INI.t t/Helper.t -script/jwebmail -script/qmauth.pl -MANIFEST -public/style.css +t/I18N2.t + +templates/webmail/readmail.html.ep +templates/webmail/writemail.html.ep +templates/webmail/displayheaders.html.ep +templates/webmail/about.html.ep +templates/webmail/login.html.ep +templates/layouts/mainlayout.html.ep templates/headers/_display_top_nav.html.ep templates/headers/_display_bot_nav.html.ep -templates/headers/_displayfolders.html.ep +templates/headers/_display_folders.html.ep templates/headers/_display_headers.html.ep -templates/_pagination1.html.ep +templates/headers/_pagination2.html.ep +templates/headers/_pagination1.html.ep templates/not_found_.html.ep templates/error.html.ep -templates/layouts/mainlayout.html.ep -templates/webmail/readmail.html.ep -templates/webmail/writemail.html.ep -templates/webmail/displayheaders.html.ep -templates/webmail/about.html.ep -templates/webmail/noaction.html.ep -templates/_pagination2.html.ep + +public/style.css + +jwebmail.conf + +README.md +CHANGES.md +LICENSE + +actions.sh + +Makefile.PL +MANIFEST diff --git a/Makefile.PL b/Makefile.PL index aad83b0..6e1ef4c 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -8,7 +8,6 @@ WriteMakefile( LICENSE => 'gpl_3', PREREQ_PM => { Mojolicious => '9.19', - Config::Tiny => 'v2.24', Crypt::URandom => 'v0.36', Digest::HMAC_MD5 => '1.04', Email::MIME => '1.949', @@ -16,7 +15,7 @@ WriteMakefile( Role::Tiny => 'v2.2', Class::Method::Modifiers => 'v2.13', TOML::Tiny => '0.15', - namespace::clean => '', + namespace::clean => '0.27', }, test => {TESTS => 't/*.t'}, ) @@ -4,10 +4,17 @@ set -euC help_text= +help_text="$help_text install\t[]\t\n" +install () { + perl Makefile.PL + make + make test + make install +} + help_text="$help_text run_tests\t[arg]\tpasses arg to the 'prove' tool\n" run_tests () { - #eval "prove -l ${1-} t/" - make test + eval "prove -l ${1-} t/" } help_text="$help_text start_dev\t[]\tstarts a hot reloading dev server\n" @@ -38,8 +45,7 @@ follow () { help_text="$help_text check_manifest\t[]\tchecks if files in the MANIFEST actually exist\n" check_manifest () { - #perl -nE 'chomp; say unless -e' MANIFEST - make ci + perl -nE 'chomp; say if $_ && !-e' MANIFEST } help_text="$help_text list_deps\t[module]\tlists all non core dependencies of a module (default=JWebmail)\n" diff --git a/lib/JWebmail/Plugin/I18N2.pm b/lib/JWebmail/Plugin/I18N2.pm index 31d6234..0d94f4b 100644 --- a/lib/JWebmail/Plugin/I18N2.pm +++ b/lib/JWebmail/Plugin/I18N2.pm @@ -151,8 +151,8 @@ package JWebmail::Plugin::I18N2::Match::Role { my $key = shift; my $value = shift; - if (@_ == 1) { # handles ($) and (\%) - $_[0]->{$key} ||= $value if ref $_[0] eq 'HASH'; + if (@_ == 1 && ref $_[0] eq 'HASH') { # handles (\%) + $_[0]->{$key} ||= $value; } elsif (@_ == 2 && ref $_[1] eq 'HASH') { # handles ($, \%) $_[1]->{$key} ||= $value; @@ -189,9 +189,7 @@ sub register { my $translator = $conf->{translator} || sub { JWebmail::Plugin::I18N2::Maketext->new(@_) }; my $defaultLang = $conf->{default_language} || 'en'; - my $fileLocation = $conf->{directory} - ? Mojo::File->new($conf->{directory}) - : $app->home->child('lang'); + my $fileLocation = $conf->{directory}; # ? Mojo::File->new($conf->{directory}) : $app->home->child('lang'); my $t = $translator->( default_language => $defaultLang, @@ -6,7 +6,7 @@ use Test::More; use JWebmail::Plugin::I18N2; -*add_option = \&JWebmail::Plugin::I18N2::Match::__add_option_no_override; +*add_option = \&JWebmail::Plugin::I18N2::Match::Role::__i18n2_add_option_no_override; subtest 'add_option' => sub { diff --git a/t/Webmail.t b/t/Webmail.t index 45eeda9..9218fb1 100644 --- a/t/Webmail.t +++ b/t/Webmail.t @@ -16,14 +16,15 @@ my $pw = JWebmail::Model::ReadMails::MockJSON::VALID_PW; my $t = Test::Mojo->new('JWebmail', { development => { read_mock => 'JWebmail::Model::ReadMails::MockJSON', block_writes => 1 }, i18n => { default_language => DEFAULT_LANGUAGE }, + session => { secure => 'none' }, }); $t->get_ok('/')->status_is(200); 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('/', form => {userid => $user, password => 'x'})->status_is(400); + $t->post_ok('/', form => {userid => $user, password => 'abcde'})->status_is(401); + $t->post_ok('/', form => {userid => $user, password => $pw})->status_is(303); }; |