Ejemplo n.º 1
0
    def test_invalidate_cache(self):
        portal_type = u"testtype"
        fti = DexterityFTI(portal_type)
        SCHEMA_CACHE.get(portal_type)
        SCHEMA_CACHE.behavior_schema_interfaces(fti)
        self.assertIn("_v_schema_behavior_schema_interfaces", fti.__dict__.keys())

        invalidate_cache(fti)
        self.assertNotIn("_v_schema_behavior_schema_interfaces", fti.__dict__.keys())
Ejemplo n.º 2
0
    def test_invalidate_cache(self):
        portal_type = u"testtype"
        fti = DexterityFTI(portal_type)
        SCHEMA_CACHE.get(portal_type)
        SCHEMA_CACHE.behavior_schema_interfaces(fti)
        self.assertIn('_v_schema_behavior_schema_interfaces',
                      fti.__dict__.keys())

        invalidate_cache(fti)
        self.assertNotIn('_v_schema_behavior_schema_interfaces',
                         fti.__dict__.keys())
Ejemplo n.º 3
0
    def test_validate_extra_behaviour(self):
        """Test that if arbitrary behaviors are added to the userprofile
        type, then the validation takes this into account.
        """
        view = CSVImportView(self.profiles, self.request)
        fti = getUtility(IDexterityFTI, name=USER_PORTAL_TYPE)
        behaviors = fti.behaviors + (
            'ploneintranet.userprofile.tests.test_import.IDummySchema', )
        fti.behaviors = behaviors
        invalidate_cache(fti)

        extra_fields_file_loc = self._get_fixture_location('extra_column.csv')
        with open(extra_fields_file_loc) as bf:
            self.assertTrue(
                view.validate(self._parse_file(bf.read())),
                'Validation unexpectedly failed.',
            )
Ejemplo n.º 4
0
    def test_validate_extra_behaviour(self):
        """Test that if arbitrary behaviors are added to the userprofile
        type, then the validation takes this into account.
        """
        view = CSVImportView(self.profiles, self.request)
        fti = getUtility(IDexterityFTI, name=USER_PORTAL_TYPE)
        behaviors = fti.behaviors + (
            'ploneintranet.userprofile.tests.test_import.IDummySchema', )
        fti.behaviors = behaviors
        invalidate_cache(fti)
        fti.__dict__.pop('_v_schema_behavior_schema_interfaces')

        extra_fields_file_loc = self._get_fixture_location(
            'extra_column.csv')
        with open(extra_fields_file_loc) as bf:
            self.assertTrue(
                view.validate(self._parse_file(bf.read())),
                'Validation unexpectedly failed.',
            )