Rarbg-torrentapi

Perl Module to interact with https://torrentapi.org
git clone https://git.e1e0.net/Rarbg-torrentapi.git
Log | Files | Refs | README | LICENSE

error.t (574B)


      1 use strict;
      2 use Test::More;
      3 use JSON;
      4 
      5 BEGIN {
      6     use_ok('Rarbg::torrentapi::Error');
      7 }
      8 
      9 # Testing Rarbg::torrentapi::Error methods and attributes
     10 can_ok( 'Rarbg::torrentapi::Error', ('new') );
     11 can_ok( 'Rarbg::torrentapi::Error', qw( error error_code ) );
     12 my $error_msg = <<ERR;
     13 {
     14     "error": "No results found",
     15     "error_code": 20
     16 }
     17 ERR
     18 my $error_res = decode_json($error_msg);
     19 my $error     = Rarbg::torrentapi::Error->new($error_res);
     20 
     21 ok( $error->error_code == 20, 'Error code check' );
     22 is( $error->error, 'No results found', 'Error message check' );
     23 
     24 done_testing;