source: main/waeup.ikoba/trunk/src/waeup/ikoba/payments/tests/test_paypal_countries.py @ 17935

Last change on this file since 17935 was 12752, checked in by Henrik Bettermann, 10 years ago

propset

  • Property svn:keywords set to Id
File size: 1.3 KB
Line 
1import unittest
2from zope.i18nmessageid.message import Message as i18nMessage
3from zope.interface.verify import verifyObject
4from zope.schema.interfaces import IVocabularyTokenized, ITerm
5from waeup.ikoba.payments.paypal_countries import COUNTRIES, COUNTRIES_VOCAB
6
7
8class CountryTests(unittest.TestCase):
9
10    def test_countries_is_dict(self):
11        # COUNTRIES is available
12        assert isinstance(COUNTRIES, dict)
13
14    def test_countries_contains_i18n_messages(self):
15        # the COUNTRIES values are i18n messages
16        assert 'DE' in COUNTRIES.keys()
17        assert isinstance(COUNTRIES['DE'], i18nMessage)
18
19
20class CountriesVocabTests(unittest.TestCase):
21
22    def test_countries_vocab_tokenized(self):
23        # we can get a countries source suitable for forms etc.
24        verifyObject(IVocabularyTokenized, COUNTRIES_VOCAB)
25
26    def test_countries_vocab_i18nized(self):
27        # vocab titles are i18nized
28        result = COUNTRIES_VOCAB.getTerm('DE')
29        assert ITerm.providedBy(result)
30        self.assertEqual(result.title, u'GERMANY')
31        assert isinstance(result.title, i18nMessage)
32
33    def test_countries_vocab_tokens_are_string(self):
34        # vocab tokens are simple strings
35        result = COUNTRIES_VOCAB.getTerm('DE')
36        assert ITerm.providedBy(result)
37        assert result.token == 'DE'
38        assert result.value == 'DE'
Note: See TracBrowser for help on using the repository browser.