def testGetSet(self): catalogue = MessageCatalogue( 'en', dict(domain1=dict(foo='foo'), domain2=dict(bar='bar'))) catalogue.set('foo1', 'foo1', 'domain1') self.assertEquals('foo', catalogue.get('foo', 'domain1')) self.assertEquals('foo1', catalogue.get('foo1', 'domain1'))
def testGetSet(self): catalogue = MessageCatalogue( 'en', dict( domain1=dict( foo='foo'), domain2=dict( bar='bar'))) catalogue.set('foo1', 'foo1', 'domain1') self.assertEquals('foo', catalogue.get('foo', 'domain1')) self.assertEquals('foo1', catalogue.get('foo1', 'domain1'))
def testAdd(self): catalogue = MessageCatalogue( 'en', dict(domain1=dict(foo='foo'), domain2=dict(bar='bar'))) catalogue.add(dict(foo1='foo1'), 'domain1') self.assertEquals('foo', catalogue.get('foo', 'domain1')) self.assertEquals('foo1', catalogue.get('foo1', 'domain1')) catalogue.add(dict(foo='bar'), 'domain1') self.assertEquals('bar', catalogue.get('foo', 'domain1')) self.assertEquals('foo1', catalogue.get('foo1', 'domain1')) catalogue.add(dict(foo='bar'), 'domain88') self.assertEquals('bar', catalogue.get('foo', 'domain88'))
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 testAdd(self): catalogue = MessageCatalogue( 'en', dict( domain1=dict( foo='foo'), domain2=dict( bar='bar'))) catalogue.add(dict(foo1='foo1'), 'domain1') self.assertEquals('foo', catalogue.get('foo', 'domain1')) self.assertEquals('foo1', catalogue.get('foo1', 'domain1')) catalogue.add(dict(foo='bar'), 'domain1') self.assertEquals('bar', catalogue.get('foo', 'domain1')) self.assertEquals('foo1', catalogue.get('foo1', 'domain1')) catalogue.add(dict(foo='bar'), 'domain88') self.assertEquals('bar', catalogue.get('foo', 'domain88'))
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)