def test_get_markdown_translations_english(self):
     filename = "basic.md"
     loader = TranslatableModelLoader(base_path=self.base_path)
     translations = loader.get_markdown_translations(filename)
     self.assertSetEqual(set(["en"]), set(translations.keys()))
     self.assertIn("Basic Content", translations["en"].html_string)
     self.assertIn("Heading", translations["en"].title)
    def test_get_markdown_translations_translated(self):
        filename = "translation.md"
        loader = TranslatableModelLoader(base_path=self.base_path)
        translations = loader.get_markdown_translations(filename)
        self.assertSetEqual(set(["en", "de"]), set(translations.keys()))

        en = translations["en"]
        self.assertIn("English Content", en.html_string)
        self.assertIn("English Heading", en.title)

        de = translations["de"]
        self.assertIn("German Content", de.html_string)
        self.assertIn("German Heading", de.title)
 def test_get_markdown_translation_english_missing_file_not_required(self):
     filename = "doesnotexist.md"
     loader = TranslatableModelLoader(base_path=self.base_path)
     # Should not raise error if required is False
     loader.get_markdown_translations(filename, required=False)
 def test_get_markdown_translation_english_missing_file_required(self):
     filename = "doesnotexist.md"
     loader = TranslatableModelLoader(base_path=self.base_path)
     with self.assertRaises(CouldNotFindMarkdownFileError):
         loader.get_markdown_translations(filename, required=True)