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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
###########################################
# Tests for Exchange requests
# Mike Schilli, 2004 (m@perlmeister.com)
###########################################
use warnings;
use strict;
use Test::More tests => 25;
use Net::Amazon;
use Net::Amazon::Result::Seller::Listing;
use Log::Log4perl qw(:easy);
#Log::Log4perl->easy_init($DEBUG);
################################################################
# Setup
################################################################
my($TESTDIR) = map { -d $_ ? $_ : () } qw(t ../t .);
require "$TESTDIR/init.pl";
my $CANNED = "$TESTDIR/canned";
################################################################
canned($CANNED, "exchange.xml");
################################################################
my $ua = Net::Amazon->new(
token => 'YOUR_AMZN_TOKEN',
#response_dump => 1,
);
# Get a request object
my $resp = $ua->search(exchange => 'Y04Y3424291Y2398445');
ok($resp->is_success(), "Successful response");
ok(defined $resp->result(), "Defined seller result");
like($resp->result()->as_string(), qr/^Bold Visions.*\(1555913164\)/,
"Exchange result as string");
my $listing = $resp->result();
is($listing->ExchangeStartDate(), "02/19/2005 04:32:20 PST",
"Listing Exchange Start Date");
is($listing->ExchangeAsin(), "1555913164",
"Listing Exchange ASIN");
is($listing->ExchangeConditionType(), "verygood",
"Listing ExchangeConditionType");
is($listing->ExchangeAsin(), "1555913164",
"Listing ExchangeAsin");
is($listing->ExchangeSellerId(), "AZPQKLIWQKVZ",
"Listing ExchangeSellerId");
is($listing->ExchangeEndDate(), "02/04/2008 04:32:20 PST",
"Listing ExchangeEndDate");
is($listing->ExchangePrice(), '$11.95',
"Listing ExchangePrice");
is($listing->ExchangeSellerRating(), "4.7",
"Listing ExchangeSellerRating");
is($listing->ExchangeStatus(), "Open",
"Listing ExchangeStatus");
is($listing->ExchangeId(), "Y04Y3424291Y2398445",
"Listing ExchangeId");
is($listing->ExchangeTitle(), "Bold Visions for the Garden: " .
"Basics, Magic & Inspiration [Paperback] by...",
"Listing ExchangeTitle");
is($listing->ExchangeQuantityAllocated(), "0",
"Listing ExchangeQuantityAllocated");
is($listing->ExchangeQuantity(), "1",
"Listing ExchangeQuantity");
is($listing->ExchangeSellerCountry(), "",
"Listing ExchangeSellerCountry");
is($listing->ExchangeSellerState(), "",
"Listing ExchangeSellerState");
is($listing->ExchangeSellerNickname(), "powells_books",
"Listing ExchangeSellerNickname");
is($listing->ExchangeFeaturedCategory(), "68297",
"Listing ExchangeFeaturedCategory");
is($listing->ExchangeAvailability(), "Usually ships in 1-2 business days",
"Listing ExchangeAvailability");
is($listing->ExchangeOfferingType(), "used",
"Listing ExchangeOfferingType");
is($listing->ListingId(), "0219T568068",
"Listing ListingId");
is($listing->ExchangeCondition(), "",
"Listing ExchangeCondition");
is($listing->ExchangeDescription(), "Title: Bold Visions for the Garden: Basics, Magic & Inspiration\n: Hartlage, Richard W.\n", "Listing ExchangeDescription");
|