def test_summary_with_vcge(self):
     from plone.app.contentrules import PloneMessageFactory as _
     e = VCGEAction()
     e.skos = [self.term]
     msg = _(u'Aplica os termos ${skos}',
             mapping=dict(skos=' or '.join(e.skos)))
     self.assertEqual(e.summary, msg)
 def test_summary_parent_vcge(self):
     e = VCGEAction()
     e.same_as_parent = True
     self.assertEqual(
         e.summary,
         u"Aplica termos da pasta no conteúdo."
     )
 def test_execute_parent_without_vcge(self):
     e = VCGEAction()
     e.same_as_parent = True
     e.skos = []
     folder = self.folder['cmf_folder']
     o = folder['cmf']
     ex = getMultiAdapter((folder, e, DummyEvent(o)), IExecutable)
     self.assertEqual(False, ex())
 def test_execute_parent_without_vcge_attribute(self):
     e = VCGEAction()
     e.same_as_parent = True
     e.skos = []
     delattr(self.folder, 'skos')
     ex = getMultiAdapter((self.folder, e, DummyEvent(self.sub_folder)),
                          IExecutable)
     self.assertEqual(False, ex())
 def test_execute_parent_without_vcge_attribute(self):
     e = VCGEAction()
     e.same_as_parent = True
     e.skos = []
     delattr(self.folder, 'skos')
     ex = getMultiAdapter((self.folder, e,
                          DummyEvent(self.sub_folder)),
                          IExecutable)
     self.assertEquals(False, ex())
 def test_execute_object_without_vcge(self):
     e = VCGEAction()
     e.same_as_parent = False
     e.skos = ['http://vocab.e.gov.br/2011/03/vcge#governo', ]
     o = self.folder['cmf']
     ex = getMultiAdapter((self.folder, e,
                          DummyEvent(o)),
                          IExecutable)
     self.assertEquals(False, ex())
 def test_execute_object_without_vcge(self):
     e = VCGEAction()
     e.same_as_parent = False
     e.skos = [
         'http://vocab.e.gov.br/2011/03/vcge#governo',
     ]
     o = self.folder['cmf']
     ex = getMultiAdapter((self.folder, e, DummyEvent(o)), IExecutable)
     self.assertEqual(False, ex())
 def test_summary_with_vcge(self):
     from plone.app.contentrules import PloneMessageFactory as _
     e = VCGEAction()
     e.skos = [
         self.term,
     ]
     msg = _(u'Aplica os termos ${skos}',
             mapping=dict(skos=' or '.join(e.skos)))
     self.assertEqual(e.summary, msg)
 def test_execute_parent_without_vcge(self):
     e = VCGEAction()
     e.same_as_parent = True
     e.skos = []
     folder = self.folder['cmf_folder']
     o = folder['cmf']
     ex = getMultiAdapter((folder, e,
                          DummyEvent(o)),
                          IExecutable)
     self.assertEquals(False, ex())
    def test_execute_same_as_parent(self):
        e = VCGEAction()
        e.same_as_parent = True
        e.skos = []

        ex = getMultiAdapter((self.folder, e, DummyEvent(self.sub_folder)),
                             IExecutable)
        self.assertEqual(True, ex())

        self.assertEqual(self.sub_folder.skos, self.folder.skos)
    def test_execute_same_as_parent(self):
        e = VCGEAction()
        e.same_as_parent = True
        e.skos = []

        ex = getMultiAdapter((self.folder, e,
                             DummyEvent(self.sub_folder)),
                             IExecutable)
        self.assertEquals(True, ex())

        self.assertEquals(self.sub_folder.skos, self.folder.skos)
    def test_execute_with_vcge(self):
        e = VCGEAction()
        e.same_as_parent = False
        e.skos = ['http://vocab.e.gov.br/2011/03/vcge#governo']

        ex = getMultiAdapter((self.folder, e,
                             DummyEvent(self.sub_folder)),
                             IExecutable)
        self.assertEqual(True, ex())

        self.assertEqual(list(self.sub_folder.skos), e.skos)
    def test_execute_with_vcge(self):
        e = VCGEAction()
        e.same_as_parent = False
        e.skos = [
            'http://vocab.e.gov.br/2011/03/vcge#governo',
        ]

        ex = getMultiAdapter((self.folder, e, DummyEvent(self.sub_folder)),
                             IExecutable)
        self.assertEqual(True, ex())

        self.assertEqual(list(self.sub_folder.skos), e.skos)
 def test_invoke_edit_view(self):
     element = getUtility(IRuleAction, name='brasil.gov.vcge.actions.VCGE')
     e = VCGEAction()
     editview = getMultiAdapter((e, self.folder.REQUEST),
                                name=element.editview)
     self.assertTrue(isinstance(editview, VCGEEditForm))
 def test_summary_parent_vcge(self):
     e = VCGEAction()
     e.same_as_parent = True
     self.assertEqual(e.summary, u'Aplica termos da pasta no conteúdo.')