Skip to content
Permalink
Browse files

🔥 test_unlink_resized_attachments_when_parent_unlink

  • Loading branch information...
RafiZz committed Feb 15, 2019
1 parent 7d0f2ca commit ab08a2448e2429f39c2a8eee7f0a3af91bbb7669
Showing with 24 additions and 3 deletions.
  1. +24 −3 ir_attachment_s3/tests/test_resized_attachments.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import logging

from odoo import api
from odoo import api, exceptions
from odoo.tests.common import HttpCase

_logger = logging.getLogger(__name__)
@@ -70,6 +70,27 @@ def test_getting_cached_images_url_instead_computing(self):
urls = [self.original_image_url, redirected_image_url, redirected_image_medium_url, redirected_image_small_url]
self.assertEqual(len(urls), len(set(urls)), 'Duplicates in URLs: %s' % urls)

# TODO
def test_unlink_resized_attachments_when_parent_unlink(self):
return
env = api.Environment(self.registry.test_cr, self.uid, {})

ir_att_model = env['ir.attachment']
ir_att_resized_model = env['ir.attachment.resized']

original_att = ir_att_model.create({'name': 'test att'})
resized_att = ir_att_model.create({'name': 'resized test att'})

ir_att_resized = ir_att_resized_model.create({
'attachment_id': original_att.id,
'resized_attachment_id': resized_att.id,
})

self.assertTrue(original_att.unlink())

with self.assertRaises(exceptions.MissingError):
original_att.write({'name': 'foo'})

with self.assertRaises(exceptions.MissingError):
ir_att_resized.write({'width': 1})

with self.assertRaises(exceptions.MissingError):
resized_att.write({'name': 'bar'})

0 comments on commit ab08a24

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.