def test_merge(self): """ Tests merge script on English source files. """ filename = os.path.join(CONFIGURATION.source_messages_dir, random_name()) generate.merge(CONFIGURATION.source_locale, target=filename) self.assertTrue(os.path.exists(filename)) os.remove(filename)
def test_merge(self): """ Tests merge script on English source files. """ filename = os.path.join(self.configuration.source_messages_dir, random_name()) generate.merge(self.configuration, self.configuration.source_locale, target=filename) assert os.path.exists(filename) os.remove(filename)
def test_merge(self): """ Tests merge script on English source files. """ test_configuration = config.Configuration(root_dir=MOCK_DJANGO_APP_DIR) filename = Path.joinpath(test_configuration.source_messages_dir, random_name()) generate.merge(test_configuration, test_configuration.source_locale, target=filename) self.assertTrue(Path.exists(filename)) Path.remove(filename)
def test_merge_with_missing_sources_strict(self): """ Tests merge script when some source files are missing. In strict mode, an exception should be raised. """ test_configuration = config.Configuration(root_dir=MOCK_DJANGO_APP_DIR) filename = Path.joinpath(test_configuration.source_messages_dir, random_name()) with self.assertRaises(ValueError): generate.merge( test_configuration, test_configuration.source_locale, sources=("django-partial.po", "nonexistingfile.po"), target=filename, fail_if_missing=True, ) self.assertFalse(Path.exists(filename))
def test_merge_with_missing_sources(self): """ Tests merge script when some source files are missing. The existing files should be merged anyway. """ test_configuration = config.Configuration(root_dir=MOCK_DJANGO_APP_DIR) filename = Path.joinpath(test_configuration.source_messages_dir, random_name()) generate.merge( test_configuration, test_configuration.source_locale, sources=("django-partial.po", "nonexistingfile.po"), target=filename, fail_if_missing=False, ) self.assertTrue(Path.exists(filename)) Path.remove(filename)