11# -*- coding: utf8 -*-
2-
2+ from plone import api
33from plone .app .testing import applyProfile
44from plone .app .testing import FunctionalTesting
55from plone .app .testing import IntegrationTesting
66from plone .app .testing import PLONE_FIXTURE
77from plone .app .testing import PloneSandboxLayer
8+ from plone .app .testing import setRoles
9+ from plone .app .testing import TEST_USER_ID
10+ from plone .namedfile .file import NamedBlobImage
811from zope .globalrequest .local import setLocal
912
1013import collective .dms .mailcontent
14+ import collective .iconifiedcategory
15+ import os
1116
1217
1318class MailcontentLayer (PloneSandboxLayer ):
@@ -22,7 +27,37 @@ def setUpZope(self, app, configurationContext):
2227 def setUpPloneSite (self , portal ):
2328 setLocal ("request" , portal .REQUEST ) # to avoid error with empty request in P6
2429 applyProfile (portal , "collective.dms.mailcontent:testing" )
25- # setRoles(portal, TEST_USER_ID, ["Manager"])
30+ setRoles (portal , TEST_USER_ID , ["Manager" ])
31+ at_folder = api .content .create (
32+ container = portal ,
33+ id = "annexes_types" ,
34+ title = "Annexes Types" ,
35+ type = "ContentCategoryConfiguration" ,
36+ exclude_from_nav = True ,
37+ )
38+ category_group = api .content .create (
39+ type = "ContentCategoryGroup" ,
40+ title = "Annexes" ,
41+ container = at_folder ,
42+ id = "annexes" ,
43+ )
44+ icon_path = os .path .join (os .path .dirname (collective .iconifiedcategory .__file__ ), "tests" , "icône1.png" )
45+ with open (icon_path , "rb" ) as fl :
46+ api .content .create (
47+ type = "ContentCategory" ,
48+ title = "To sign" ,
49+ container = category_group ,
50+ icon = NamedBlobImage (fl .read (), filename = u"icône1.png" ),
51+ id = "to_sign" ,
52+ predefined_title = "To be signed" ,
53+ # confidential=True,
54+ # to_print=True,
55+ to_sign = True ,
56+ # signed=True,
57+ # publishable=True,
58+ # only_pdf=True,
59+ show_preview = False ,
60+ )
2661
2762
2863COLLECTIVE_DMS_MAILCONTENT = MailcontentLayer ()
0 commit comments