line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
# perl -I lib t/build_message.t |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
325
|
use Sentry; |
|
1
|
|
|
|
|
58691
|
|
|
1
|
|
|
|
|
34
|
|
5
|
1
|
|
|
1
|
|
511
|
use Test::More; |
|
1
|
|
|
|
|
49582
|
|
|
1
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
|
|
70
|
my $dsn = 'http://public_key:secret_key@example.com/1234'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
|
|
7
|
my $sentry = Sentry->new( $dsn, tags => { tag1 => 'val1' } ); |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
|
|
2310
|
is( $sentry->{secret_key}, 'secret_key', 'secret_key parsed from dsn' ); |
12
|
1
|
|
|
|
|
767
|
is( $sentry->{public_key}, 'public_key', 'public_key parsed from dsn' ); |
13
|
|
|
|
|
|
|
is( |
14
|
|
|
|
|
|
|
$sentry->{uri}, |
15
|
1
|
|
|
|
|
333
|
'http://example.com/api/1234/store/', |
16
|
|
|
|
|
|
|
'uri was constructed' |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
|
|
332
|
my $a = $sentry->_build_message( |
20
|
|
|
|
|
|
|
message => 'Arbeiten', |
21
|
|
|
|
|
|
|
some_unwanted_attr => 'Msg' |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
112
|
is( $a->{message}, 'Arbeiten', 'Message attribute is correct' ); |
25
|
1
|
|
|
|
|
330
|
is( $a->{level}, 'info', 'Default level is info if not specified' ); |
26
|
1
|
|
|
|
|
337
|
is( $a->{tags}{tag1}, 'val1', 'Tag specified in constructor is set' ); |
27
|
1
|
|
|
|
|
331
|
is( $a->{platform}, 'perl', 'Default platform is perl' ); |
28
|
|
|
|
|
|
|
is( $a->{some_unwanted_attr}, |
29
|
|
|
|
|
|
|
undef, |
30
|
1
|
|
|
|
|
346
|
'Filter parameters that are not defined in Sentry API for less payload' ); |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
370
|
$a = $sentry->_build_message( |
33
|
|
|
|
|
|
|
message => 'Perl rocks', |
34
|
|
|
|
|
|
|
tags => { tag2 => 'val2' } |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
is( $a->{tags}{tag1}, |
38
|
1
|
|
|
|
|
73
|
'val1', 'Default tag saved after new _build_message call' ); |
39
|
1
|
|
|
|
|
336
|
is( $a->{tags}{tag2}, 'val2', 'New tag set' ); |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
341
|
done_testing(); |