Finance-Quote 1.43 released!

Eugenedev iteugene at gmail.com
Mon Nov 6 19:45:19 EST 2017


Test fails

lisa /tmp # export ONLINE_TEST=true
lisa /tmp # perl /root/.cpan/build/Finance-Quote-1.43-0/t/alphavantage.t
1..77
malformed JSON string, neither array, object, number, string or atom, at
character offset 0 (before "<!DOCTYPE html>\n\t<...") at
/usr/local/lib64/perl5/5.24.3/Finance/Quote/AlphaVantage.pm line 73.
# Looks like your test exited with 255 before it could output anything.

That is default test file comes with module
lisa /tmp # cat /root/.cpan/build/Finance-Quote-1.43-0/t/alphavantage.t
#!/usr/bin/perl -w
use strict;
use Test::More;
use Finance::Quote;

if ( not $ENV{"ONLINE_TEST"} ) {
    plan skip_all => 'Set $ENV{ONLINE_TEST} to run this test';
}

if ( not $ENV{"ALPHAVANTAGE_API_KEY"} ) {
    plan skip_all =>
        'Set $ENV{ALPHAVANTAGE_API_KEY} to run this test; get one at
https://www.alphavantage.co';
}

my $q        = Finance::Quote->new();
my $year     = ( localtime() )[5] + 1900;
my $lastyear = $year - 1;

my @symbols =  qw/ IBM CSCO SOLB.BR SAP.DE LSE.L VFIAX T/;

plan tests => 10*(1+$#symbols)+7;

my %quotes = $q->alphavantage( @symbols, "BOGUS" );
ok(%quotes);

foreach my $symbol (@symbols) {
    ok( $quotes{ $symbol, "success" }, "$symbol success" );
    ok( $quotes{ $symbol, "symbol" } eq $symbol , "$symbol defined" );
    ok( $quotes{ $symbol, "open" } > 0, "$symbol returned open" );
    ok( $quotes{ $symbol, "close" } > 0, "$symbol returned close" );
    ok( $quotes{ $symbol, "last" } > 0, "$symbol returned last" );
    ok( $quotes{ $symbol, "high" } > 0, "$symbol returned high" );
    ok( $quotes{ $symbol, "low" } > 0, "$symbol returned low" );
    ok( $quotes{ $symbol, "volume" } >= 0, "$symbol returned volume" );
    ok(    substr( $quotes{ $symbol, "isodate" }, 0, 4 ) == $year
               || substr( $quotes{ $symbol, "isodate" }, 0, 4 ) == $lastyear
);
    ok(    substr( $quotes{ $symbol, "date" }, 6, 4 ) == $year
               || substr( $quotes{ $symbol, "date" }, 6, 4 ) == $lastyear );
}

is( $quotes{ "IBM", "currency" }, 'USD' );
is( $quotes{ "CSCO", "currency" }, 'USD' );
is( $quotes{ "SOLB.BR", "currency" }, 'EUR' );
is( $quotes{ "SAP.DE", "currency" }, 'EUR' );
is( $quotes{ "LSE.L", "currency" }, 'GBP' );

ok( !$quotes{ "BOGUS", "success" } );
lisa /tmp # 




--
Sent from: http://gnucash.1415818.n4.nabble.com/GnuCash-User-f1415819.html


More information about the gnucash-user mailing list