Пример #1
0
    def test_mailchimp_locator_updateCache_method(self):
        from collective.mailchimp.locator import MailchimpLocator
        locator = MailchimpLocator()
        locator.initialize()
        # These tests pass when we run this test method separately,
        # but fail when running all tests.  Skip them because they are
        # not what we really want to test here.
        #
        # self.assertEqual(locator.registry[locator.key_account], None)
        # self.assertEqual(locator.registry[locator.key_groups], None)
        # self.assertEqual(locator.registry[locator.key_lists], None)
        locator.updateCache()
        account = locator.registry[locator.key_account]
        self.assertTrue(isinstance(account, dict))
        self.assertEqual(account[u'account_id'], u'8d3a3db4d97663a9074efcc16')
        self.assertEqual(account[u'account_name'], u"Freddie's Jokes")
        groups = locator.registry[locator.key_groups]
        self.assertTrue(isinstance(groups, dict))
        self.assertEqual(groups.keys(),
                         [u'f6257645gs', u'f6267645gs', u'57afe96172'])
        self.assertEqual(
            groups[groups.keys()[0]].keys(),
            [u'total_items', 'interests', u'_links', u'categories', u'list_id']
            )

        self.assertTrue(
            isinstance(locator.registry[locator.key_lists], tuple))
        self.assertEqual(len(locator.registry[locator.key_lists]), 3)
        # It does not complain when there is no api key
        locator.settings.api_key = None
        locator.updateCache()
Пример #2
0
    def test_mailchimp_locator_updateCache_method(self):
        from collective.mailchimp.locator import MailchimpLocator
        locator = MailchimpLocator()
        locator.initialize()
        # These tests pass when we run this test method separately,
        # but fail when running all tests.  Skip them because they are
        # not what we really want to test here.
        #
        # self.assertEqual(locator.registry[locator.key_account], None)
        # self.assertEqual(locator.registry[locator.key_groups], None)
        # self.assertEqual(locator.registry[locator.key_lists], None)
        locator.updateCache()
        account = locator.registry[locator.key_account]
        self.assertTrue(isinstance(account, dict))
        self.assertEqual(account[u'account_id'], u'8d3a3db4d97663a9074efcc16')
        self.assertEqual(account[u'account_name'], u"Freddie's Jokes")
        groups = locator.registry[locator.key_groups]
        self.assertTrue(isinstance(groups, dict))
        self.assertEqual(groups.keys(),
                         [u'f6257645gs', u'f6267645gs', u'57afe96172'])
        self.assertEqual(groups[groups.keys()[0]].keys(), [
            u'total_items', 'interests', u'_links', u'categories', u'list_id'
        ])

        self.assertTrue(isinstance(locator.registry[locator.key_lists], tuple))
        self.assertEqual(len(locator.registry[locator.key_lists]), 3)
        # It does not complain when there is no api key
        locator.settings.api_key = None
        locator.updateCache()