File: token-errs.t

package info (click to toggle)
webauth 4.7.0-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 7,932 kB
  • sloc: ansic: 28,341; sh: 12,031; perl: 8,361; xml: 6,856; makefile: 459; php: 7
file content (30 lines) | stat: -rwxr-xr-x 833 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/perl
#
# Test suite for webauth token object creation errors
#
# Written by Jon Robertson <jonrober@stanford.edu>
# Copyright 2013
#     The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.

use strict;
use warnings;

use Test::More tests => 4;

BEGIN { use_ok ('WebAuth', 3.06, qw(:const)) }
BEGIN { use_ok ('WebAuth::Token') }

# Check that sending WebAuth::Key different objects than it expect fails.
my $token;
eval {
    $token = WebAuth::Token::new('WebAuth::Token', '', undef);
};
like ($@, qr{^WebAuth::Token cannot be used directly}ms,
    'Trying to use WebAuth::Token directly fails');
eval {
    $token = WebAuth::Token->new('WebAuth::NotKey', 'a');
};
like ($@, qr{^second argument must be a WebAuth object}ms,
    '... as does not giving it a WebAuth object');