mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-13 15:34:49 -06:00
[MIG] attachment_zipped_download: Migration to 17.0
TT52268
This commit is contained in:
parent
e5387e2db6
commit
9bb905a9f5
@ -2,7 +2,7 @@
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
{
|
||||
"name": "Attachment Zipped Download",
|
||||
"version": "16.0.2.0.2",
|
||||
"version": "17.0.1.0.0",
|
||||
"category": "Tools",
|
||||
"website": "https://github.com/OCA/knowledge",
|
||||
"author": "Tecnativa, Odoo Community Association (OCA)",
|
||||
|
@ -68,12 +68,3 @@ msgstr "No se encontró ningún documento para descargar."
|
||||
#, python-format
|
||||
msgid "attachments.zip"
|
||||
msgstr "adjuntos.zip"
|
||||
|
||||
#~ msgid "Display Name"
|
||||
#~ msgstr "Nombre mostrado"
|
||||
|
||||
#~ msgid "ID"
|
||||
#~ msgstr "ID"
|
||||
|
||||
#~ msgid "Last Modified on"
|
||||
#~ msgstr "Última modificación el"
|
||||
|
@ -63,9 +63,3 @@ msgstr "Aucune pièce jointe téléchargeable trouvé."
|
||||
#, python-format
|
||||
msgid "attachments.zip"
|
||||
msgstr "pieces-jointes.zip"
|
||||
|
||||
#~ msgid "Display Name"
|
||||
#~ msgstr "Nom affiché"
|
||||
|
||||
#~ msgid "Last Modified on"
|
||||
#~ msgstr "Dernière modification le"
|
||||
|
@ -64,12 +64,3 @@ msgstr "Non sono stati trovati documenti da scaricare."
|
||||
#, python-format
|
||||
msgid "attachments.zip"
|
||||
msgstr "attachments.zip"
|
||||
|
||||
#~ msgid "Display Name"
|
||||
#~ msgstr "Nome visualizzato"
|
||||
|
||||
#~ msgid "ID"
|
||||
#~ msgstr "ID"
|
||||
|
||||
#~ msgid "Last Modified on"
|
||||
#~ msgstr "Ultima modifica il"
|
||||
|
@ -1,17 +1,18 @@
|
||||
# Copyright 2022-2023 Tecnativa - Víctor Martínez
|
||||
# Copyright 2022-2024 Tecnativa - Víctor Martínez
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
import base64
|
||||
from unittest import TestCase
|
||||
|
||||
from odoo.exceptions import AccessError
|
||||
from odoo.tests import HttpCase, SavepointCase, new_test_user
|
||||
from odoo.tests import HttpCase, new_test_user
|
||||
|
||||
from odoo.addons.base.tests.common import BaseCommon
|
||||
|
||||
|
||||
class TestAttachmentZippedDownloadBase(TestCase):
|
||||
class TestAttachmentZippedDownloadBase(BaseCommon):
|
||||
@classmethod
|
||||
def _create_attachment(cls, env, user, name, model=False, res_id=False):
|
||||
def _create_attachment(cls, user, name, model=False, res_id=False):
|
||||
return (
|
||||
env["ir.attachment"]
|
||||
cls.env["ir.attachment"]
|
||||
.with_user(user)
|
||||
.create(
|
||||
{
|
||||
@ -25,22 +26,13 @@ class TestAttachmentZippedDownloadBase(TestCase):
|
||||
|
||||
|
||||
class TestAttachmentZippedDownload(HttpCase, TestAttachmentZippedDownloadBase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
ctx = {
|
||||
"mail_create_nolog": True,
|
||||
"mail_create_nosubscribe": True,
|
||||
"mail_notrack": True,
|
||||
"no_reset_password": True,
|
||||
}
|
||||
self.user = new_test_user(
|
||||
self.env,
|
||||
login="test-user",
|
||||
context=ctx,
|
||||
)
|
||||
test_1 = self._create_attachment(self.env, self.user, "test1.txt")
|
||||
test_2 = self._create_attachment(self.env, self.user, "test2.txt")
|
||||
self.attachments = test_1 + test_2
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.user = new_test_user(cls.env, login="test-user")
|
||||
test_1 = cls._create_attachment(cls.user, "test1.txt")
|
||||
test_2 = cls._create_attachment(cls.user, "test2.txt")
|
||||
cls.attachments = test_1 + test_2
|
||||
|
||||
def test_action_attachments_download(self):
|
||||
self.authenticate("test-user", "test-user")
|
||||
@ -49,27 +41,19 @@ class TestAttachmentZippedDownload(HttpCase, TestAttachmentZippedDownloadBase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
||||
class TestAttachmentZipped(SavepointCase, TestAttachmentZippedDownloadBase):
|
||||
class TestAttachmentZipped(TestAttachmentZippedDownloadBase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
ctx = {
|
||||
"mail_create_nolog": True,
|
||||
"mail_create_nosubscribe": True,
|
||||
"mail_notrack": True,
|
||||
"no_reset_password": True,
|
||||
}
|
||||
cls.user = new_test_user(
|
||||
cls.env,
|
||||
login="test-user",
|
||||
password="test-user",
|
||||
groups="base.group_user,base.group_partner_manager",
|
||||
context=ctx,
|
||||
)
|
||||
test_1 = cls._create_attachment(cls.env, cls.user, "test1.txt")
|
||||
test_2 = cls._create_attachment(cls.env, cls.user, "test2.txt")
|
||||
test_1 = cls._create_attachment(cls.user, "test1.txt")
|
||||
test_2 = cls._create_attachment(cls.user, "test2.txt")
|
||||
test_3 = cls._create_attachment(
|
||||
cls.env,
|
||||
cls.user,
|
||||
"test3.txt",
|
||||
model="res.partner",
|
||||
@ -83,7 +67,6 @@ class TestAttachmentZipped(SavepointCase, TestAttachmentZippedDownloadBase):
|
||||
|
||||
def test_create_temp_zip_access_denined(self):
|
||||
attachments = self.attachments | self._create_attachment(
|
||||
self.env,
|
||||
self.uid,
|
||||
"test4.txt",
|
||||
model="ir.ui.view",
|
||||
|
@ -3,12 +3,10 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
from odoo_test_helper import FakeModelLoader
|
||||
|
||||
from odoo.tests import SavepointCase
|
||||
|
||||
from .test_attachment_zipped_download import TestAttachmentZippedDownloadBase
|
||||
|
||||
|
||||
class TestMixin(SavepointCase, TestAttachmentZippedDownloadBase):
|
||||
class TestMixin(TestAttachmentZippedDownloadBase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
@ -21,26 +19,23 @@ class TestMixin(SavepointCase, TestAttachmentZippedDownloadBase):
|
||||
|
||||
cls.loader.update_registry((ResPartner,))
|
||||
|
||||
cls.partner_1 = cls.env.ref("base.res_partner_1")
|
||||
cls.partner_2 = cls.env.ref("base.res_partner_2")
|
||||
cls.partner_3 = cls.env.ref("base.res_partner_3")
|
||||
cls.partner_1 = cls.env["res.partner"].create({"name": "Test partner 1"})
|
||||
cls.partner_2 = cls.env["res.partner"].create({"name": "Test partner 2"})
|
||||
cls.partner_3 = cls.env["res.partner"].create({"name": "Test partner 3"})
|
||||
|
||||
cls.partner_1_f1 = cls._create_attachment(
|
||||
cls.env,
|
||||
cls.env.uid,
|
||||
"partner_1-f1.txt",
|
||||
model="res.partner",
|
||||
res_id=cls.partner_1.id,
|
||||
)
|
||||
cls.partner_1_f2 = cls._create_attachment(
|
||||
cls.env,
|
||||
cls.env.uid,
|
||||
"partner_1-f2.txt",
|
||||
model="res.partner",
|
||||
res_id=cls.partner_1.id,
|
||||
)
|
||||
cls.partner_2_f1 = cls._create_attachment(
|
||||
cls.env,
|
||||
cls.env.uid,
|
||||
"partner_2-f1.txt",
|
||||
model="res.partner",
|
||||
|
1
test-requirements.txt
Normal file
1
test-requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
odoo_test_helper
|
Loading…
Reference in New Issue
Block a user