Пример #1
0
    def test_token_input_widget_subjects(self):

        class MockCatalog(object):
            def uniqueValuesFor(self, *args):
                return ["maçã", "foo"]

        self.obj.portal_catalog = MockCatalog()
        self.obj.Subject = lambda: ["resumé", "bar"]

        widget = TokenInputWidget(self.request)
        widget.context = self.obj

        result = widget.js()

        self.assertTrue(isinstance(result, unicode))
        self.assertTrue(u"resumé" in result)
        self.assertTrue(u"bar" in result)
Пример #2
0
    def test_token_input_widget_unicode(self):
        # see: https://github.com/collective/collective.z3cform.widgets/issues/20

        class MockCatalog(object):
            def uniqueValuesFor(self, *args):
                return ["maçã"]

        self.obj.portal_catalog = MockCatalog()
        self.obj.Subject = lambda: ["resumé"]

        widget = TokenInputWidget(self.request)
        widget.context = self.obj

        result = widget.js()

        self.assertTrue(isinstance(result, unicode))
        self.assertTrue(u"resumé" in result)