Skip to content

Commit

Permalink
Merge pull request #284 from laslabs/bugfix/9.0/sass
Browse files Browse the repository at this point in the history
[FIX][9.0] travis: Add SASS
  • Loading branch information
pedrobaeza authored Nov 25, 2016
2 parents 6b05131 + 2391037 commit 46ae987
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 54 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ env:
virtualenv:
system_site_packages: true

before_install:
- rvm install ruby --latest
- gem install bootstrap-sass
- gem install compass --pre

install:
- git clone https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
Expand Down
9 changes: 7 additions & 2 deletions website_logo/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@
##############################################################################

import functools
import logging
from cStringIO import StringIO

import openerp
from openerp.addons.web import http
from openerp.addons.web.http import request
from openerp.modules import get_module_resource


db_monodb = http.db_monodb
_logger = logging.getLogger(__name__)


class Website(http.Controller):
Expand Down Expand Up @@ -79,6 +82,8 @@ def website_logo(self, dbname=None, **kw):
response = http.send_file(
image, filename=imgname, mtime=mtime)
return response
except Exception:
return http.send_file(placeholder(imgname))
except Exception: # pragma: no cover
_logger.exception(openerp._(
'Could not get website logo, falling back to default',
))
return http.send_file(placeholder(imgname))
34 changes: 0 additions & 34 deletions website_logo/migrations/8.0.2.0.0/post-migration.py

This file was deleted.

11 changes: 0 additions & 11 deletions website_logo/migrations/8.0.2.0.0/pre-migration.py

This file was deleted.

13 changes: 6 additions & 7 deletions website_logo/tests/test_logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def setUp(self):
self.image_val = 'Test'.encode('base64')

def test_image_logo_get_domain(self):
""" Test logo get w/ domain """
""" It should search for logo using defined domain """
mk = mock.MagicMock()
mk.execute.side_effect = StopTestException
expect = 'Test'
Expand All @@ -44,7 +44,7 @@ def test_image_logo_get_domain(self):
)

def test_image_logo_get_no_domain(self):
""" Test logo get w/out domain """
""" It should search for logo without a domain """
mk = mock.MagicMock()
mk.execute.side_effect = StopTestException
with self.assertRaises(StopTestException):
Expand Down Expand Up @@ -81,10 +81,9 @@ def test_image_logo_returns_fetch_io(self, str_mk):
@mock.patch('%s.StringIO' % imp_cont)
@mock.patch(imp_req)
def test_default_on_exception(self, imp_mk, str_mk, http_mk, func_mk):
http_mk.send_file.side_effect = StopTestException
""" It should send the default logo if there is an exception """
with mock.patch('%s.openerp' % imp_cont) as mk:
cr_mk = mk.modules.registry.Registry().cursor().__enter__()
cr_mk.execute.side_effect = StopTestException
with self.assertRaises(StopTestException):
self.cont_obj.website_logo()
http_mk.send_file.assert_called_once(func_mk())
cr_mk.execute.side_effect = Exception
self.cont_obj.website_logo()
func_mk.partial().assert_called_once_with('website_nologo.png')

0 comments on commit 46ae987

Please sign in to comment.