def test_removing_unkwown_file_raises_exception(self): registry = SCSSRegistry() with self.assertRaises(ValueError) as cm: registry.remove_file('foo') self.assertEquals('There is no file "foo" registered.', str(cm.exception))
def test_removing_a_file_only_when_request_interface_matches(self): registry = SCSSRegistry() registry.add_file('foo', 'foo.scss') registry.remove_file('foo', layer=IFoo) self.assertEquals(['foo.scss'], registry.get_files(None, None)) request = Context(IFoo) self.assertEquals([], registry.get_files(None, request))
def remove_scss(context, **kwargs): """Register an .scss file. """ registry = queryUtility(ISCSSRegistry) if registry is None: registry = SCSSRegistry() provideUtility(registry) registry.remove_file(kwargs['name'], for_=kwargs.get('for_', Interface), layer=kwargs.get('layer', Interface))
def test_removing_a_file(self): registry = SCSSRegistry() registry.add_file('foo', 'foo.scss') registry.remove_file('foo') self.assertEquals([], registry.get_files(None, None))