def testGetadd_resource(self): catalogue = MessageCatalogue('en') catalogue.add_resource('r') catalogue.add_resource('r') catalogue.add_resource('r1') resources = catalogue.get_resources() resources.sort(key=len) self.assertEquals(['r', 'r1'], resources)
def testGetadd_resource(self): catalogue = MessageCatalogue('en') catalogue.add_resource('r') catalogue.add_resource('r') catalogue.add_resource('r1') resources = catalogue.get_resources() resources.sort(key=len) self.assertEquals(['r', 'r1'], resources)
def testAddCatalogue(self): catalogue = MessageCatalogue( 'en', dict(domain1=dict(foo='foo'), domain2=dict(bar='bar'))) catalogue.add_resource('r') catalogue1 = MessageCatalogue('en', dict(domain1=dict(foo1='foo1'))) catalogue1.add_resource('r1') catalogue.add_catalogue(catalogue1) self.assertEquals('foo', catalogue.get('foo', 'domain1')) self.assertEquals('foo1', catalogue.get('foo1', 'domain1')) resources = catalogue.get_resources() resources.sort(key=len) self.assertEquals(['r', 'r1'], resources)
def testAddCatalogue(self): catalogue = MessageCatalogue( 'en', dict( domain1=dict( foo='foo'), domain2=dict( bar='bar'))) catalogue.add_resource('r') catalogue1 = MessageCatalogue('en', dict(domain1=dict(foo1='foo1'))) catalogue1.add_resource('r1') catalogue.add_catalogue(catalogue1) self.assertEquals('foo', catalogue.get('foo', 'domain1')) self.assertEquals('foo1', catalogue.get('foo1', 'domain1')) resources = catalogue.get_resources() resources.sort(key=len) self.assertEquals(['r', 'r1'], resources)