def test_mlng_placeholder_actions_get_copy_languages(self):
     actions = MLNGPlaceholderActions()
     fr = Translations.objects.get(language_code="fr")
     de = Translations.objects.get(language_code="de")
     en = Translations.objects.get(language_code="en")
     fieldname = "placeholder"
     fr_copy_languages = actions.get_copy_languages(fr.placeholder, Translations, fieldname)
     de_copy_languages = actions.get_copy_languages(de.placeholder, Translations, fieldname)
     en_copy_languages = actions.get_copy_languages(en.placeholder, Translations, fieldname)
     EN = ("en", "English")
     FR = ("fr", "French")
     self.assertEqual(fr_copy_languages, [EN])
     self.assertEqual(de_copy_languages, [EN, FR])
     self.assertEqual(en_copy_languages, [FR])
示例#2
0
    def test_mlng_placeholder_actions_empty_copy(self):
        actions = MLNGPlaceholderActions()
        fr = Translations.objects.get(language_code='fr')
        de = Translations.objects.get(language_code='de')
        self.assertEqual(fr.placeholder.cmsplugin_set.count(), 1)
        self.assertEqual(de.placeholder.cmsplugin_set.count(), 0)

        new_plugins = actions.copy(fr.placeholder, 'de', 'placeholder', Translations, 'fr')
        self.assertEqual(len(new_plugins), 0)

        de = self.reload(de)
        fr = self.reload(fr)

        self.assertEqual(fr.placeholder.cmsplugin_set.count(), 1)
        self.assertEqual(de.placeholder.cmsplugin_set.count(), 0)
示例#3
0
 def test_05_mlng_placeholder_actions_no_placeholder(self):
     actions = MLNGPlaceholderActions()
     nl = Translations.objects.get(language_code='nl')
     de = Translations.objects.get(language_code='de')
     self.assertEqual(nl.placeholder, None)
     self.assertEqual(de.placeholder.cmsplugin_set.count(), 0)
     
     okay = actions.copy(de.placeholder, 'nl', 'placeholder', Translations, 'de')
     self.assertEqual(okay, False)
     
     de = self.reload(de)
     nl = self.reload(nl)
     
     nl = Translations.objects.get(language_code='nl')
     de = Translations.objects.get(language_code='de')
示例#4
0
    def test_mlng_placeholder_actions_empty_copy(self):
        actions = MLNGPlaceholderActions()
        fr = Translations.objects.get(language_code='fr')
        de = Translations.objects.get(language_code='de')
        self.assertEqual(fr.placeholder.get_plugins().count(), 1)
        self.assertEqual(de.placeholder.get_plugins().count(), 0)

        new_plugins = actions.copy(fr.placeholder, 'de', 'placeholder', Translations, 'fr')
        self.assertEqual(len(new_plugins), 0)

        de = self.reload(de)
        fr = self.reload(fr)

        self.assertEqual(fr.placeholder.get_plugins().count(), 1)
        self.assertEqual(de.placeholder.get_plugins().count(), 0)
    def test_mlng_placeholder_actions_copy(self):
        actions = MLNGPlaceholderActions()
        fr = Translations.objects.get(language_code="fr")
        de = Translations.objects.get(language_code="de")
        self.assertEqual(fr.placeholder.cmsplugin_set.count(), 1)
        self.assertEqual(de.placeholder.cmsplugin_set.count(), 0)

        new_plugins = actions.copy(de.placeholder, "fr", "placeholder", Translations, "de")
        self.assertEqual(len(new_plugins), 1)

        de = self.reload(de)
        fr = self.reload(fr)

        self.assertEqual(fr.placeholder.cmsplugin_set.count(), 1)
        self.assertEqual(de.placeholder.cmsplugin_set.count(), 1)
示例#6
0
    def test_mlng_placeholder_actions_no_placeholder(self):
        actions = MLNGPlaceholderActions()
        Translations.objects.filter(language_code='nl').update(placeholder=None)
        de = Translations.objects.get(language_code='de')
        nl = Translations.objects.get(language_code='nl')
        self.assertEqual(nl.placeholder, None)
        self.assertEqual(de.placeholder.get_plugins().count(), 0)

        okay = actions.copy(de.placeholder, 'nl', 'placeholder', Translations, 'de')
        self.assertEqual(okay, False)

        de = self.reload(de)
        nl = self.reload(nl)

        nl = Translations.objects.get(language_code='nl')
        de = Translations.objects.get(language_code='de')
    def test_mlng_placeholder_actions_no_placeholder(self):
        actions = MLNGPlaceholderActions()
        Translations.objects.filter(language_code="nl").update(placeholder=None)
        de = Translations.objects.get(language_code="de")
        nl = Translations.objects.get(language_code="nl")
        self.assertEqual(nl.placeholder, None)
        self.assertEqual(de.placeholder.cmsplugin_set.count(), 0)

        okay = actions.copy(de.placeholder, "nl", "placeholder", Translations, "de")
        self.assertEqual(okay, False)

        de = self.reload(de)
        nl = self.reload(nl)

        nl = Translations.objects.get(language_code="nl")
        de = Translations.objects.get(language_code="de")
示例#8
0
 def test_mlng_placeholder_actions_get_copy_languages(self):
     actions = MLNGPlaceholderActions()
     fr = Translations.objects.get(language_code='fr')
     de = Translations.objects.get(language_code='de')
     en = Translations.objects.get(language_code='en')
     fieldname = 'placeholder'
     fr_copy_languages = actions.get_copy_languages(fr.placeholder,
                                                    Translations, fieldname)
     de_copy_languages = actions.get_copy_languages(de.placeholder,
                                                    Translations, fieldname)
     en_copy_languages = actions.get_copy_languages(en.placeholder,
                                                    Translations, fieldname)
     EN = ('en', 'English')
     FR = ('fr', 'French')
     self.assertEqual(fr_copy_languages, [EN])
     self.assertEqual(de_copy_languages, [EN, FR])
     self.assertEqual(en_copy_languages, [FR])
示例#9
0
 def test_mlng_placeholder_actions_get_copy_languages(self):
     actions = MLNGPlaceholderActions()
     fr = Translations.objects.get(language_code='fr')
     de = Translations.objects.get(language_code='de')
     en = Translations.objects.get(language_code='en')
     fieldname = 'placeholder'
     fr_copy_languages = actions.get_copy_languages(
         fr.placeholder, Translations, fieldname
     )
     de_copy_languages = actions.get_copy_languages(
         de.placeholder, Translations, fieldname
     )
     en_copy_languages = actions.get_copy_languages(
         en.placeholder, Translations, fieldname
     )
     EN = ('en', 'English')
     FR = ('fr', 'French')
     self.assertEqual(fr_copy_languages, [EN])
     self.assertEqual(de_copy_languages, [EN, FR])
     self.assertEqual(en_copy_languages, [FR])