Пример #1
0
    def test_add_descendants_adds_all_subdossiers(self):
        self.login(self.regular_user)

        model = Dossier(self.dossier)
        model._add_descendants()

        self.assertEquals(set([self.subdossier, self.subdossier2]),
                          set([mod.obj for mod in model.dossiers.values()]))
Пример #2
0
    def test_add_descendants_adds_all_subdossiers(self):
        self.login(self.regular_user)

        model = Dossier(self.dossier)
        model._add_descendants()

        self.assertEquals(
            set([self.subdossier, self.subdossier2]),
            set([mod.obj for mod in model.dossiers.values()]))
Пример #3
0
    def test_add_descendants_adds_also_documents_in_tasks(self):
        dossier = create(Builder('dossier'))
        task = create(Builder('task').within(dossier))
        document = create(Builder('document').within(task))

        model = Dossier(dossier)
        model._add_descendants()

        self.assertEqual(set([document]),
                         set([doc.obj for doc in model.documents.values()]))
Пример #4
0
    def test_add_descendants_adds_also_documents_in_tasks(self):
        dossier = create(Builder('dossier'))
        task = create(Builder('task').within(dossier))
        document = create(Builder('document').within(task))

        model = Dossier(dossier)
        model._add_descendants()

        self.assertEqual(
            set([document]),
            set([doc.obj for doc in model.documents.values()]))
Пример #5
0
    def test_add_descendants_adds_all_containing_documents(self):
        dossier = create(Builder('dossier'))
        document1 = create(Builder('document').within(dossier))
        create(Builder('document'))
        document3 = create(Builder('document').within(dossier))

        model = Dossier(dossier)
        model._add_descendants()

        self.assertEquals(set([document1, document3]),
                          set([doc.obj for doc in model.documents.values()]))
Пример #6
0
    def test_add_descendants_adds_all_subdossiers(self):
        dossier = create(Builder('dossier'))
        subdossier1 = create(Builder('dossier').within(dossier))
        create(Builder('dossier'))
        subdossier3 = create(Builder('dossier').within(dossier))

        model = Dossier(dossier)
        model._add_descendants()

        self.assertEquals(set([subdossier3, subdossier1]),
                          set([mod.obj for mod in model.dossiers.values()]))
Пример #7
0
    def test_add_descendants_adds_all_containing_documents(self):
        dossier = create(Builder('dossier'))
        document1 = create(Builder('document').within(dossier))
        create(Builder('document'))
        document3 = create(Builder('document').within(dossier))

        model = Dossier(dossier)
        model._add_descendants()

        self.assertEquals(
            set([document1, document3]),
            set([doc.obj for doc in model.documents.values()]))
Пример #8
0
    def test_add_descendants_adds_all_subdossiers(self):
        dossier = create(Builder('dossier'))
        subdossier1 = create(Builder('dossier').within(dossier))
        create(Builder('dossier'))
        subdossier3 = create(Builder('dossier').within(dossier))

        model = Dossier(dossier)
        model._add_descendants()

        self.assertEquals(
            set([subdossier3, subdossier1]),
            set([mod.obj for mod in model.dossiers.values()]))
Пример #9
0
    def test_add_descendants_adds_all_containing_documents(self):
        self.login(self.manager)

        model = Dossier(self.dossier)
        model._add_descendants()

        brains = api.content.find(context=self.dossier, depth=1,
                                  portal_type='opengever.document.document')
        expected_documents = set([brain.getObject() for brain in brains])

        self.assertEquals(expected_documents,
                          set([doc.obj for doc in model.documents.values()]))
Пример #10
0
    def test_add_descendants_adds_all_containing_documents(self):
        self.login(self.manager)

        model = Dossier(self.dossier)
        model._add_descendants()

        brains = api.content.find(context=self.dossier,
                                  depth=1,
                                  portal_type='opengever.document.document')
        expected_documents = set([brain.getObject() for brain in brains])

        self.assertEquals(expected_documents,
                          set([doc.obj for doc in model.documents.values()]))
Пример #11
0
    def test_add_descendants_adds_also_documents_in_tasks(self):
        """If this were implemented it would show up in the test
        test_add_descendants_adds_all_containing_documents
        """
        self.login(self.regular_user)
        dossier = create(Builder('dossier'))
        task = create(Builder('task').within(dossier))
        document = create(Builder('document').within(task))

        model = Dossier(dossier)
        model._add_descendants()

        self.assertEqual(set([document]),
                         set([doc.obj for doc in model.documents.values()]))
Пример #12
0
    def test_add_descendants_adds_also_documents_in_tasks(self):
        """If this were implemented it would show up in the test
        test_add_descendants_adds_all_containing_documents
        """
        self.login(self.regular_user)
        dossier = create(Builder('dossier'))
        task = create(Builder('task').within(dossier))
        document = create(Builder('document').within(task))

        model = Dossier(dossier)
        model._add_descendants()

        self.assertEqual(
            set([document]),
            set([doc.obj for doc in model.documents.values()]))