File: 23-attachment.t

package info (click to toggle)
librt-client-rest-perl 1%3A0.56-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 568 kB
  • sloc: perl: 4,205; makefile: 9
file content (45 lines) | stat: -rw-r--r-- 986 bytes parent folder | download | duplicates (3)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!perl
# vim:ft=perl:

use strict;
use warnings;

use Test::More tests => 26;
use Test::Exception;

use constant METHODS => (
    'new', 'to_form', 'from_form', 'rt_type',

    # attrubutes:
    'id', 'creator_id', 'subject', 'created', 'message_id', 'parent_id',
    'content_type', 'file_name', 'transaction_id', 'content', 'headers',
    'parent', 'content_encoding',
);

BEGIN {
    use_ok('RT::Client::REST::Attachment');
}

for my $method (METHODS) {
    can_ok('RT::Client::REST::Attachment', $method);
}

my $ticket;

lives_ok {
    $ticket = RT::Client::REST::Attachment->new;
} 'Ticket can get successfully created';

for my $method (qw(store search count)) {
    throws_ok {
        $ticket->$method;
    } 'RT::Client::REST::Exception'; # make sure exception inheritance works

    throws_ok {
        $ticket->$method;
    } 'RT::Client::REST::Object::IllegalMethodException',
        "method '$method' should throw an exception";
}

ok('attachment' eq $ticket->rt_type);