Example #1
0
    def test_get_latest_activity_no_latest(self):
        """
        If the matching ProjectLocale has no latest_translation, return
        None.
        """
        ProjectLocaleFactory.create(project=self.project, locale=self.locale, latest_translation=None)

        assert_is_none(ProjectLocale.get_latest_activity(self.project, self.locale))
Example #2
0
    def test_get_latest_activity_success(self):
        """
        If the matching ProjectLocale has a latest_translation, return
        it's latest_activity.
        """
        translation = TranslationFactory.create(locale=self.locale, entity__resource__project=self.project)
        ProjectLocaleFactory.create(project=self.project, locale=self.locale, latest_translation=translation)

        assert_equal(ProjectLocale.get_latest_activity(self.project, self.locale), translation.latest_activity)
Example #3
0
    def test_get_latest_activity_no_latest(self):
        """
        If the matching ProjectLocale has no latest_translation, return
        None.
        """
        ProjectLocaleFactory.create(project=self.project,
                                    locale=self.locale,
                                    latest_translation=None)

        assert_is_none(
            ProjectLocale.get_latest_activity(self.project, self.locale))
Example #4
0
    def test_project_locale_added(self):
        """
        When a locale is added to a project, has_changed should be set
        to True.
        """
        project = ProjectFactory.create(locales=[], has_changed=False)
        assert_false(project.has_changed)

        locale = LocaleFactory.create()
        ProjectLocaleFactory.create(project=project, locale=locale)
        project.refresh_from_db()
        assert_true(project.has_changed)
Example #5
0
    def test_project_locale_added(self):
        """
        When a locale is added to a project, has_changed should be set
        to True.
        """
        project = ProjectFactory.create(locales=[], has_changed=False)
        assert_false(project.has_changed)

        locale = LocaleFactory.create()
        ProjectLocaleFactory.create(project=project, locale=locale)
        project.refresh_from_db()
        assert_true(project.has_changed)
Example #6
0
    def test_get_latest_activity_success(self):
        """
        If the matching ProjectLocale has a latest_translation, return
        it's latest_activity.
        """
        translation = TranslationFactory.create(
            locale=self.locale, entity__resource__project=self.project)
        ProjectLocaleFactory.create(project=self.project,
                                    locale=self.locale,
                                    latest_translation=translation)

        assert_equal(
            ProjectLocale.get_latest_activity(self.project, self.locale),
            translation.latest_activity)
Example #7
0
def private_project_locale():
    yield ProjectLocaleFactory.create()
Example #8
0
def public_project_locale():
    yield ProjectLocaleFactory.create(project__visibility="public")
Example #9
0
def public_project_locale():
    yield ProjectLocaleFactory.create(project__visibility=Project.Visibility.PUBLIC)