root/trunk/plagger/t/plugins/Filter-GuessTimeZoneByDomain/base.t

Revision 1756 (checked in by miyagawa, 14 years ago)

add test for US tzs

Line 
1 use strict;
2 use t::TestPlagger;
3
4 test_plugin_deps;
5 plan 'no_plan';
6 run_eval_expected;
7
8 __END__
9
10 === By country code
11 --- input config
12 plugins:
13   - module: CustomFeed::Debug
14     config:
15       title: Foo
16       entry:
17         - link: http://d.hatena.ne.jp/
18           date: 2006/10/14 12:00:00
19   - module: Filter::GuessTimeZoneByDomain
20 --- expected
21 is $context->update->feeds->[0]->entries->[0]->date->time_zone->name, "Asia/Tokyo";
22
23 === By IP
24 --- input config
25 plugins:
26   - module: CustomFeed::Debug
27     config:
28       title: Foo
29       entry:
30         - link: http://bulknews.net/
31           date: 2006/10/14 12:00:00
32   - module: Filter::GuessTimeZoneByDomain
33 --- expected
34 is $context->update->feeds->[0]->entries->[0]->date->time_zone->name, "Asia/Tokyo";
35
36 === By IP
37 --- input config
38 plugins:
39   - module: CustomFeed::Debug
40     config:
41       title: Foo
42       entry:
43         - link: http://www.time.co.uk/
44           date: 2006/10/14 12:00:00
45   - module: Filter::GuessTimeZoneByDomain
46 --- expected
47 is $context->update->feeds->[0]->entries->[0]->date->time_zone->name, "Europe/London";
48
49 === Don't use IP::Country
50 --- input config
51 plugins:
52   - module: CustomFeed::Debug
53     config:
54       title: Foo
55       entry:
56         - link: http://www.time.co.uk/
57           date: 2006/10/14 12:00:00
58   - module: Filter::GuessTimeZoneByDomain
59     config:
60       use_ip_country: 0
61 --- expected
62 is $context->update->feeds->[0]->entries->[0]->date->time_zone->name, "floating";
63
64 === Conflict: CC by default
65 --- input config
66 plugins:
67   - module: CustomFeed::Debug
68     config:
69       title: Foo
70       entry:
71         - link: http://www.sixapart.jp/
72           date: 2006/10/14 12:00:00
73   - module: Filter::GuessTimeZoneByDomain
74 --- expected
75 is $context->update->feeds->[0]->entries->[0]->date->time_zone->name, "Asia/Tokyo";
76
77 === Force upgrade GMT
78 --- input config
79 plugins:
80   - module: CustomFeed::Debug
81     config:
82       title: Foo
83       entry:
84         - link: http://bulknews.net/
85           date: 2006/10/14 12:00:00 GMT
86   - module: Filter::GuessTimeZoneByDomain
87     config:
88       conflict_policy: ip
89 --- expected
90 is $context->update->feeds->[0]->entries->[0]->date->time_zone->name, "Asia/Tokyo";
91 is $context->update->feeds->[0]->entries->[0]->date->iso8601, "2006-10-14T21:00:00";
92
93 === United States has lots of TZs, thus skip
94 --- input config
95 plugins:
96   - module: CustomFeed::Debug
97     config:
98       title: Foo
99       entry:
100         - link: http://del.icio.us/
101           date: 2006/10/14 12:00:00
102   - module: Filter::GuessTimeZoneByDomain
103 --- expected
104 ok $context->update->feeds->[0]->entries->[0]->date->time_zone->is_floating;
105
Note: See TracBrowser for help on using the browser.