ExtDirect/Test/Data/Poll.pm untested

filter: Statementstmt 0.0% 0 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 13 CC 1 SCAR 6.9
CC
1
Cov
0%
get_tests
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # This does not need to be indexed by PAUSE
2 package
3 RPC::ExtDirect::Test::Data::Poll;
4  
5 use strict;
6 use warnings;
7  
8 # This aref contains definitions/data for Poll tests
9 my $tests = [{
10 name => 'Two events',
11
12 config => {
13 api_path => '/api',
14 router_path => '/router',
15 poll_path => '/events',
16 debug => 1,
17 password => 'Usual, please',
18 },
19
20 input => {
21 method => 'POST',
22 url => '/events',
23 cgi_url => '/poll1',
24
25 content => undef,
26 },
27
28 output => {
29 status => 200,
30 content_type => qr|^application/json\b|,
31 content_length => 109,
32 comparator => 'cmp_json',
33 content =>
34 q|[{"data":["foo"],|.
35 q| "name":"foo_event",|.
36 q| "type":"event"},|.
37 q| {"data":{"foo":"bar"},|.
38 q| "name":"bar_event",|.
39 q| "type":"event"}]|,
40 },
41 }, {
42 name => 'One event',
43
44 config => {
45 api_path => '/api',
46 router_path => '/router',
47 poll_path => '/events',
48 debug => 1,
49 password => 'Ein kaffe bitte',
50 },
51
52 input => {
53 method => 'POST',
54 url => '/events',
55 cgi_url => '/poll2',
56
57 content => undef,
58 },
59
60 output => {
61 status => 200,
62 content_type => qr|^application/json\b|,
63 content_length => 65,
64 comparator => 'cmp_json',
65 content =>
66 q|{"data":"Uno cappuccino, presto!",|.
67 q| "name":"coffee",|.
68 q| "type":"event"}|,
69 },
70 }, {
71 name => 'Failed method',
72
73 config => {
74 api_path => '/api',
75 router_path => '/router',
76 poll_path => '/events',
77 debug => 1,
78 password => 'Whiskey, straight away!',
79 },
80
81 input => {
82 method => 'POST',
83 url => '/events',
84 cgi_url => '/poll3',
85
86 content => undef,
87 },
88
89 output => {
90 status => 200,
91 content_type => qr|^application/json\b|,
92 content_length => 44,
93 comparator => 'cmp_json',
94 content => q|{"data":"","name":"__NONE__","type":"event"}|,
95 },
96 }, {
97 name => 'No events at all',
98
99 config => {
100 api_path => '/api',
101 router_path => '/router',
102 poll_path => '/events',
103 debug => 1,
104 password => "Sorry sir, but that's not on the menu?",
105 },
106
107 input => {
108 method => 'POST',
109 url => '/events',
110 cgi_url => '/poll4',
111
112 input => undef,
113 },
114
115 output => {
116 status => 200,
117 content_type => qr|^application/json\b|,
118 content_length => 44,
119 comparator => 'cmp_json',
120 content => q|{"data":"","name":"__NONE__","type":"event"}|,
121 },
122 }, {
123 name => 'Invalid Event provider output',
124
125 config => {
126 api_path => '/api',
127 router_path => '/router',
128 poll_path => '/events',
129 debug => 1,
130 password => "Hey man! There's a roach in my soup!",
131 },
132
133 input => {
134 method => 'POST',
135 url => '/events',
136 cgi_url => '/poll5',
137
138 input => undef,
139 },
140
141 output => {
142 status => 200,
143 content_type => qr|^application/json\b|,
144 content_length => 44,
145 comparator => 'cmp_json',
146 content => q|{"data":"","name":"__NONE__","type":"event"}|,
147 },
148 }];
149  
150 sub get_tests { return $tests };
151  
152 1;