4teamwork / ftw.builder

Builder pattern for creating Plone objects in tests
3 stars 0 forks source link

Creating dexterity folder fails #23

Closed elioschmutz closed 10 years ago

elioschmutz commented 10 years ago

@jone If I create a default dexterity folder with the builder:

create(Builder('folder'))

the following error appears

WrongContainedType: ([WrongType('test_user_1_', <type 'unicode'>, '')], 'creators')

The problem is somewhere in the self.arguments. There is:

{'creators': ('test_user_1_',), 'language': 'de'}

but it should be

{'creators': (u'test_user_1_',), 'language': 'de'}
deiferni commented 10 years ago

confirmed :wink: i have fixed this already in a quick&dirty fix for bgbern https://github.com/4teamwork/bgbern.cityguide/blob/master/bgbern/cityguide/tests/builders.py#L17

jone commented 10 years ago

Is the folder a dexterty type (plone.app.contenttypes installed)? Or why is this suddenly occuring?

elioschmutz commented 10 years ago

Yes, it's a dexterity type.

Here is the configuration:

setup.py:

      install_requires=[
          'Plone',
          'plone.app.contenttypes',
          ....

metadata.xml:

<?xml version="1.0"?>
<metadata>
  <version>1000</version>
  <dependencies>
    <dependency>profile-plone.app.contenttypes:default</dependency>
  </dependencies>
</metadata>

testing.py:

    def setUpZope(self, app, configurationContext):
        import my.package
        xmlconfig.file(
            'configure.zcml', ,my.package, context=configurationContext)

    def setUpPloneSite(self, portal):
        applyProfile(portal, 'my.package:default')

builders.py:

    class FolderBuilder(DexterityBuilder):
        portal_type = 'Folder'

    builder_registry.register('folder', FolderBuilder, force=True)

test_xy.py:

    create(Builder('folder'))
maethu commented 10 years ago

Well, can somebody @deiferni @elioschmutz provide a fix?

lukasgraf commented 10 years ago

@elioschmutz is that double comma , , actually part of your testing.py, or is that a typo introduced when posting it here?

elioschmutz commented 10 years ago

@lukasgraf it's a typo in the post