You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
918 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
  3. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
  4. from openerp.tests.common import TransactionCase
  5. from openerp.modules import get_module_resource
  6. class ResPartnerCase(TransactionCase):
  7. def setUp(self):
  8. super(ResPartnerCase, self).setUp()
  9. self.partner = self.env["res.partner"].create({
  10. "name": "somebody",
  11. })
  12. def tearDown(self):
  13. """Remove stored images."""
  14. self.partner.image = False
  15. return super(ResPartnerCase, self).tearDown()
  16. def test_set_image(self):
  17. """Image is OK."""
  18. path = get_module_resource(
  19. "partner_multi_image", "static/description", "icon.png")
  20. with open(path, "rb") as image:
  21. self.partner.image = image.read().encode("base64")
  22. self.assertIsNot(self.partner.image, False)