def test_mutating_styles_directly_does_not_store_them(self): adapter = ICustomStyles(self.portal) input = {'css.body-background': 'red'} adapter.set_styles(input) output = adapter.get_styles() self.assertEquals(input, output) output['css.body-background'] = 'green' self.assertEquals(input, adapter.get_styles(), 'The result of get_styles could be modified so that' ' it changed in the storage, which should not happen.')
def test_mutating_styles_directly_does_not_store_them(self): adapter = ICustomStyles(self.portal) input = {'css.body-background': 'red'} adapter.set_styles(input) output = adapter.get_styles() self.assertEquals(input, output) output['css.body-background'] = 'green' self.assertEquals( input, adapter.get_styles(), 'The result of get_styles could be modified so that' ' it changed in the storage, which should not happen.')
def test_caches_are_invalidated_when_setting_NEW_values(self): adapter = ICustomStyles(self.portal) self.assertEquals({}, adapter.get_styles()) invalidate_cache_mock = self.mocker.replace( 'plonetheme.onegov.browser.customstyles.invalidate_cache') self.expect(invalidate_cache_mock()) self.replay() adapter.set('css.body-background', 'blue')
def test_caches_are_invalidated_when_setting_NEW_values(self): adapter = ICustomStyles(self.portal) self.assertEquals({}, adapter.get_styles()) invalidate_cache_mock = self.mocker.replace( 'plonetheme.onegov.browser.customstyles.invalidate_cache') self.expect(invalidate_cache_mock()) self.replay() adapter.set('css.body-background', 'blue')
def test_setting_and_getting_styles(self): adapter = ICustomStyles(self.portal) styles = {'css.body-background': 'red'} adapter.set_styles(styles) self.assertEquals(styles, adapter.get_styles())
def test_setting_and_getting_styles(self): adapter = ICustomStyles(self.portal) styles = {'css.body-background': 'red'} adapter.set_styles(styles) self.assertEquals(styles, adapter.get_styles())