def test_should_register_changes(self):
        inserting.link_documents_bundles_with_documents(
            self.documents_bundle, ["doc-1", "doc-2"], self.session
        )

        _changes = self.session.changes.filter()

        self.assertEqual(1, len(_changes))
        self.assertEqual(self.documents_bundle.id(), _changes[0]["id"])
        self.assertEqual("DocumentsBundle", _changes[0]["entity"])
示例#2
0
    def test_should_not_insert_duplicated_documents(self):
        inserting.link_documents_bundles_with_documents(
            self.documents_bundle,
            [{
                "id": "doc-1",
                "order": "0001"
            }, {
                "id": "doc-1",
                "order": "0001"
            }],
            self.session,
        )

        self.assertEqual([{
            "id": "doc-1",
            "order": "0001"
        }], self.documents_bundle.documents)
示例#3
0
    def test_should_link_documents_bundle_with_documents(self):
        inserting.link_documents_bundles_with_documents(
            self.documents_bundle,
            [{
                "id": "doc-1",
                "order": "0001"
            }, {
                "id": "doc-2",
                "order": "0002"
            }],
            self.session,
        )

        self.assertEqual(
            [{
                "id": "doc-1",
                "order": "0001"
            }, {
                "id": "doc-2",
                "order": "0002"
            }],
            self.documents_bundle.documents,
        )
    def test_should_not_insert_duplicated_documents(self):
        inserting.link_documents_bundles_with_documents(
            self.documents_bundle, ["doc-1", "doc-1"], self.session
        )

        self.assertEqual(["doc-1"], self.documents_bundle.documents)
    def test_should_link_documents_bundle_with_documents(self):
        inserting.link_documents_bundles_with_documents(
            self.documents_bundle, ["doc-1", "doc-2"], self.session
        )

        self.assertEqual(["doc-1", "doc-2"], self.documents_bundle.documents)