3 # This Koha test module is a stub!
4 # Add more tests here!!!
9 use Test
::More tests
=> 8;
13 use_ok
('C4::External::Amazon');
16 my $context = C4
::Context
->new();
18 my $locale = $context->preference('AmazonLocale');
20 $context->set_preference('AmazonLocale','CA');
21 $context->clear_syspref_cache();
22 is
(get_amazon_tld
,'.ca','Changes locale to CA and tests get_amazon_tld');
24 $context->set_preference('AmazonLocale','DE');
25 $context->clear_syspref_cache();
26 is
(get_amazon_tld
,'.de','Changes locale to DE and tests get_amazon_tld');
28 $context->set_preference('AmazonLocale','FR');
29 $context->clear_syspref_cache();
30 is
(get_amazon_tld
,'.fr','Changes locale to FR and tests get_amazon_tld');
32 $context->set_preference('AmazonLocale','JP');
33 $context->clear_syspref_cache();
34 is
(get_amazon_tld
,'.jp','Changes locale to JP and tests get_amazon_tld');
36 $context->set_preference('AmazonLocale','UK');
37 $context->clear_syspref_cache();
38 is
(get_amazon_tld
,'.co.uk','Changes locale to UK and tests get_amazon_tld');
40 $context->set_preference('AmazonLocale','US');
41 $context->clear_syspref_cache();
42 is
(get_amazon_tld
,'.com','Changes locale to US and tests get_amazon_tld');
44 $context->set_preference('AmazonLocale','NZ');
45 $context->clear_syspref_cache();
46 is
(get_amazon_tld
,'.com','Changes locale to one not in the array and tests get_amazon_tld');
48 $context->set_preference('AmazonLocale',$locale);
49 $context->clear_syspref_cache();