Debian Codegraph @

ebay/xt/bysellerid.t

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1
2 # $Id: bysellerid.t,v 1.1 2015-09-13 14:30:09 Martin Exp $
3
4 use constant DEBUG_CONTENTS => 0;
5
6 use Date::Manip;
7 use ExtUtils::testlib;
8 use Test::More no_plan;
9
10 use WWW::Search;
11 use WWW::Search::Test;
12 BEGIN
13 {
14 use blib;
15 use_ok('WWW::Search::Ebay::BySellerID');
16 } # end of BEGIN block
17
18 my $iDebug;
19 my $iDump;
20
21 tm_new_engine('Ebay::BySellerID');
22 # goto DEBUG_NOW;
23 goto CONTENTS if DEBUG_CONTENTS;
24 # goto CONTENTS;
25
26 diag("Sending 0-page seller ID query...");
27 $iDebug = 0;
28 $iDump = 0;
29 # This test returns no results (but we should not get an HTTP error):
30 WWW::Search::Test::_tm_run_test('normal', $WWW::Search::Test::bogus_query, 0, 0, $iDebug, $iDump, 0);
31
32 goto SKIP_MULTI;
33 pass('no-op');
34 # DEBUG_NOW:
35 pass('no-op');
36 MULTI_RESULT:
37 {
38 $TODO = 'WWW::Search::Ebay can not fetch multiple pages';
39 diag("Sending multi-page seller ID query...");
40 $iDebug = 0;
41 $iDump = 0;
42 # This query returns many pages of results:
43 tm_run_test('normal', 'toymom21957', 200, undef, $iDebug);
44 cmp_ok(1, '<', $WWW::Search::Test::oSearch->{requests_made}, 'got multiple pages');
45 $TODO = q{};
46 }
47
48 DEBUG_NOW:
49 pass('no-op');
50 SKIP_MULTI:
51 pass('no-op');
52 CONTENTS:
53 diag("Sending 1-page seller ID query to check contents...");
54 $iDebug = DEBUG_CONTENTS ? 2 : 0;
55 $iDump = 0;
56 $WWW::Search::Test::sSaveOnError = q{bysellerid-failed.html};
57 # local $TODO = 'Too hard to find a seller with consistently one page of auctions';
58 tm_run_test('normal', 'oldschool2017', 1, 199, $iDebug, $iDump);
59 # Now get the results and inspect them:
60 my @ao = $WWW::Search::Test::oSearch->results();
61 cmp_ok(0, '<', scalar(@ao), 'got some results');
62 my @ara = (
63 ['url', 'like', qr{\Ahttps?://(cgi|www)\d*\.ebay\.com}, 'URL is really from ebay.com'],
64 ['title', 'ne', 'q{}', 'Title is not empty'],
65 ['change_date', 'date', 'change_date is really a date'],
66 ['description', 'like', qr{Item #\d+;}, 'description contains item #'],
67 ['description', 'like', qr{\b(\d+|no)\s+bids?}, # }, # Emacs bug
68 'result bidcount is ok'],
69 ['bid_count', 'like', qr{\A\d+\Z}, 'bid_count is a number'],
70 );
71 WWW::Search::Test::test_most_results(\@ara, 0.95);
72
73 __END__
74