Exemple #1
0
def test_projectlocale_latest_activity_success(translation_a):
    """
    If the matching ProjectLocale has a latest_translation, return
    it's latest_activity.
    """
    project = translation_a.entity.resource.project
    locale = translation_a.locale
    assert ProjectLocale.get_latest_activity(project, locale)
    assert (ProjectLocale.get_latest_activity(
        project, locale) == translation_a.latest_activity)
Exemple #2
0
def test_projectlocale_latest_activity_success(translation_a):
    """
    If the matching ProjectLocale has a latest_translation, return
    it's latest_activity.
    """
    project = translation_a.entity.resource.project
    locale = translation_a.locale
    assert ProjectLocale.get_latest_activity(project, locale)
    assert (
        ProjectLocale.get_latest_activity(project, locale)
        == translation_a.latest_activity
    )
Exemple #3
0
 def test_get_latest_activity_doesnt_exist(self):
     """
     If no ProjectLocale exists with the given project/locale,
     return None.
     """
     assert_false(ProjectLocale.objects.filter(project=self.project, locale=self.locale).exists())
     assert_is_none(ProjectLocale.get_latest_activity(self.project, self.locale))
Exemple #4
0
def test_projectlocale_latest_activity_no_latest(project_a, locale_a):
    """
    If the matching ProjectLocale has no latest_translation, return
    None.
    """
    ProjectLocaleFactory.create(project=project_a, locale=locale_a)
    assert ProjectLocale.get_latest_activity(project_a, locale_a) is None
Exemple #5
0
def test_projectlocale_latest_activity_no_latest(projectX, localeX):
    """
    If the matching ProjectLocale has no latest_translation, return
    None.
    """
    ProjectLocale.objects.create(project=projectX, locale=localeX)
    assert (ProjectLocale.get_latest_activity(projectX, localeX) is None)
Exemple #6
0
def test_projectlocale_latest_activity_no_latest(project_a, locale_a):
    """
    If the matching ProjectLocale has no latest_translation, return
    None.
    """
    ProjectLocaleFactory.create(project=project_a, locale=locale_a)
    assert ProjectLocale.get_latest_activity(project_a, locale_a) is None
Exemple #7
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))
Exemple #8
0
def test_projectlocale_latest_activity_doesnt_exist(project_a, locale_a):
    """
    If no ProjectLocale exists with the given project/locale,
    return None.
    """
    assert not (ProjectLocale.objects.filter(project=project_a,
                                             locale=locale_a).exists())
    assert ProjectLocale.get_latest_activity(project_a, locale_a) is None
Exemple #9
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)
Exemple #10
0
 def test_get_latest_activity_doesnt_exist(self):
     """
     If no ProjectLocale exists with the given project/locale,
     return None.
     """
     assert_false(
         ProjectLocale.objects.filter(project=self.project,
                                      locale=self.locale).exists())
     assert_is_none(
         ProjectLocale.get_latest_activity(self.project, self.locale))
Exemple #11
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))
Exemple #12
0
def test_projectlocale_latest_activity_doesnt_exist(project_a, locale_a):
    """
    If no ProjectLocale exists with the given project/locale,
    return None.
    """
    assert not (
        ProjectLocale.objects
        .filter(project=project_a, locale=locale_a)
        .exists()
    )
    assert ProjectLocale.get_latest_activity(project_a, locale_a) is None
Exemple #13
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)