summaryrefslogtreecommitdiff
path: root/t/01-static.t
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-04-18 12:22:17 -0400
committerDaniel Friesel <derf@finalrewind.org>2019-04-18 12:22:17 -0400
commit015b51ba84a7897979d0d09bb13c2ea655c3032f (patch)
treec3dd504143823c78663c51bfe57ad4ec2245f02a /t/01-static.t
parent065c844fde679686ad82e2dcf62a12f3b0b690f1 (diff)
Add a basic test for static content
Diffstat (limited to 't/01-static.t')
-rw-r--r--t/01-static.t37
1 files changed, 37 insertions, 0 deletions
diff --git a/t/01-static.t b/t/01-static.t
new file mode 100644
index 0000000..3f4b152
--- /dev/null
+++ b/t/01-static.t
@@ -0,0 +1,37 @@
+#!/usr/bin/env perl
+use Mojo::Base -strict;
+
+use Test::More;
+use Test::Mojo;
+
+# Include application
+use FindBin;
+require "$FindBin::Bin/../index.pl";
+
+my $t = Test::Mojo->new(Travelynx => {db => {user => 'travelynx_temp'}});
+
+$t->get_ok('/')->status_is(200);
+$t->text_like('a[href="/register"]' => qr{Registrieren});
+$t->text_like('a[href="/login"]' => qr{Anmelden});
+
+$t->get_ok('/register')->status_is(200);
+$t->element_exists('input[name="csrf_token"]');
+$t->element_exists('a[href="/impressum"]');
+$t->text_like('button' => qr{Registrieren});
+
+$t->get_ok('/login')->status_is(200);
+$t->element_exists('input[name="csrf_token"]');
+$t->text_like('button' => qr{Anmelden});
+
+$t->get_ok('/about')->status_is(200);
+
+# Protected sites should redirect to login form
+
+for my $protected (qw(/account /change_password /history /s/EE)) {
+ $t->get_ok($protected)->text_like('button' => qr{Anmelden});
+}
+
+# Otherwise, we expect a 404
+$t->get_ok('/definitelydoesnotexist')->status_is(404);
+
+done_testing();