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.
 
 
 
 
 

35 lines
1.5 KiB

# Copyright 2019 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests import common
from ..models.res_company import URL_BASE
class TestResCompany(common.TransactionCase):
IMG_GREEN = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUl' \
+ 'EQVR42mNk+M/wHwAEBgIApD5fRAAAAABJRU5ErkJggg=='
def test_scss_attachment(self):
num_scss = self.env['ir.attachment'].search_count([
('url', 'ilike', '%s%%' % URL_BASE)
])
num_companies = self.env['res.company'].search_count([])
self.assertEqual(num_scss, num_companies, "Invalid scss attachments")
def test_change_logo(self):
company_id = self.env['res.company'].search([], limit=1)
company_id.sudo().write({'logo': self.IMG_GREEN})
self.assertEqual(company_id.color_navbar_bg, '#00ff00',
"Invalid Navbar Background Color")
def test_create_unlink_company(self):
company_id = self.env['res.company'].create({
'name': 'Company Test'
})
self.assertEqual(company_id.color_navbar_bg, False,
"Invalid Navbar Background Color")
self.test_scss_attachment()
company_id.sudo().write({'logo': self.IMG_GREEN})
self.assertEqual(company_id.color_navbar_bg, '#00ff00',
"Invalid Navbar Background Color")
company_id.sudo().unlink()
self.test_scss_attachment()