コード例 #1
0
 def test_generate_multilingual(self):
     configuration = Configuration('/tmp', 'https://example.com')
     configuration.locales.clear()
     configuration.locales['nl'] = LocaleConfiguration('nl')
     configuration.locales['en'] = LocaleConfiguration('en')
     sut = LocalizedPathUrlGenerator(configuration)
     self.assertEquals('/nl/index.html',
                       sut.generate('/index.html', 'text/html'))
     self.assertEquals(
         '/en/index.html', sut.generate('/index.html', 'text/html', locale='en'))
コード例 #2
0
ファイル: test_url.py プロジェクト: bartfeenstra/betty
 def test_generate_with_invalid_value(self):
     configuration = Configuration('/tmp', 'https://example.com')
     sut = LocalizedPathUrlGenerator(configuration)
     with self.assertRaises(ValueError):
         sut.generate(9, 'text/html')
コード例 #3
0
ファイル: test_url.py プロジェクト: bartfeenstra/betty
 def test_generate_absolute(self, expected: str, resource: str):
     configuration = Configuration('/tmp', 'https://example.com')
     sut = LocalizedPathUrlGenerator(configuration)
     self.assertEquals(expected, sut.generate(
         resource, 'text/html', absolute=True))
コード例 #4
0
ファイル: test_url.py プロジェクト: bartfeenstra/betty
 def test_generate_with_clean_urls(self, expected: str, resource: str):
     configuration = Configuration('/tmp', 'https://example.com')
     configuration.clean_urls = True
     sut = LocalizedPathUrlGenerator(configuration)
     self.assertEquals(expected, sut.generate(resource, 'text/html'))