aboutsummaryrefslogtreecommitdiffstats
path: root/t/email.t
diff options
context:
space:
mode:
Diffstat (limited to 't/email.t')
-rw-r--r--t/email.t20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/email.t b/t/email.t
new file mode 100644
index 000000000..40a650da5
--- /dev/null
+++ b/t/email.t
@@ -0,0 +1,20 @@
+use strict;
+use warnings;
+
+use Test::More;
+use FixMyStreet::Email;
+
+my $secret = FixMyStreet::DB->resultset('Secret')->update({
+ secret => 'abcdef123456' });
+
+my $hash = FixMyStreet::Email::hash_from_id("report", 123);
+is $hash, '8fb274c6', 'Hash generation okay';
+
+my $token = FixMyStreet::Email::generate_verp_token("report", 123);
+is $token, "report-123-8fb274c6", 'Token generation okay';
+
+my ($type, $id) = FixMyStreet::Email::check_verp_token($token);
+is $type, "report", 'Correct type from token';
+is $id, 123, 'Correct ID from token';
+
+done_testing();