当前位置: 首页>>代码示例>>Python>>正文


Python UserFactory.create_batch方法代码示例

本文整理汇总了Python中pontoon.base.tests.UserFactory.create_batch方法的典型用法代码示例。如果您正苦于以下问题:Python UserFactory.create_batch方法的具体用法?Python UserFactory.create_batch怎么用?Python UserFactory.create_batch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pontoon.base.tests.UserFactory的用法示例。


在下文中一共展示了UserFactory.create_batch方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_plural_translations

# 需要导入模块: from pontoon.base.tests import UserFactory [as 别名]
# 或者: from pontoon.base.tests.UserFactory import create_batch [as 别名]
    def test_plural_translations(self):
        """
        If entity has some plural translations and approved translations their authors
        should be included in commit message.
        """
        first_author, second_author, third_author = UserFactory.create_batch(3)

        TranslationFactory.create(
            locale=self.translated_locale,
            entity=self.main_db_entity,
            user=first_author,
            approved=True
        )
        TranslationFactory.create(
            locale=self.translated_locale,
            entity=self.main_db_entity,
            user=third_author,
            approved=True,
            plural_form=1
        )
        TranslationFactory.create(
            locale=self.translated_locale,
            entity=self.main_db_entity,
            user=second_author,
            approved=False
        )

        self.changeset.update_vcs_entity(self.translated_locale, self.main_db_entity, MagicMock())

        self.changeset.execute_update_vcs()

        assert_equal(
            set(self.changeset.commit_authors_per_locale[self.translated_locale.code]),
            {first_author, third_author}
        )
开发者ID:MikkCZ,项目名称:pontoon,代码行数:37,代码来源:test_changeset.py

示例2: test_multiple_translations

# 需要导入模块: from pontoon.base.tests import UserFactory [as 别名]
# 或者: from pontoon.base.tests.UserFactory import create_batch [as 别名]
    def test_multiple_translations(self):
        """
        If there are multiple translations to the same locale, only authors of
        the final approved version should be returned.
        """
        first_author, second_author = UserFactory.create_batch(2)

        TranslationFactory.create(
            locale=self.translated_locale,
            entity=self.main_db_entity,
            user=first_author,
            approved=True
        )
        TranslationFactory.create(
            locale=self.translated_locale,
            entity=self.main_db_entity,
            user=second_author,
            approved=False
        )

        self.changeset.update_vcs_entity(self.translated_locale, self.main_db_entity, MagicMock())

        self.changeset.execute_update_vcs()

        assert_equal(
            self.changeset.commit_authors_per_locale[self.translated_locale.code],
            [first_author]
        )
开发者ID:MikkCZ,项目名称:pontoon,代码行数:30,代码来源:test_changeset.py

示例3: test_multiple_authors

# 需要导入模块: from pontoon.base.tests import UserFactory [as 别名]
# 或者: from pontoon.base.tests.UserFactory import create_batch [as 别名]
    def test_multiple_authors(self):
        """
        Tests if multiple authors are passed to commit message.
        """
        first_author, second_author = UserFactory.create_batch(2)
        self.changeset.commit_authors_per_locale = {
            self.translated_locale.code: [first_author, second_author]
        }
        self.db_project.repository_for_path = Mock(return_value=self.repository)

        commit_changes(self.db_project, self.vcs_project, self.changeset)
        self.repository.commit.assert_called_with(
            CONTAINS(first_author.display_name, second_author.display_name),
            first_author,
            os.path.join(FAKE_CHECKOUT_PATH, self.translated_locale.code)
        )
开发者ID:G33KS44n,项目名称:pontoon,代码行数:18,代码来源:test_core.py

示例4: test_multiple_authors

# 需要导入模块: from pontoon.base.tests import UserFactory [as 别名]
# 或者: from pontoon.base.tests.UserFactory import create_batch [as 别名]
    def test_multiple_authors(self):
        """
        Commit message should include authors from translations of separate
        entities.
        """
        first_author, second_author = UserFactory.create_batch(2)
        TranslationFactory.create(
            locale=self.translated_locale,
            entity=self.main_db_entity,
            user=first_author,
            approved=True
        )
        TranslationFactory.create(
            locale=self.translated_locale,
            entity=self.main_db_entity,
            approved=False
        )
        TranslationFactory.create(
            locale=self.translated_locale,
            entity=self.other_db_entity,
            user=second_author,
            approved=True
        )
        TranslationFactory.create(
            locale=self.translated_locale,
            entity=self.other_db_entity,
            approved=False
        )

        self.changeset.update_vcs_entity(self.translated_locale, self.main_db_entity, MagicMock())
        self.changeset.update_vcs_entity(self.translated_locale, self.other_db_entity, MagicMock())

        self.changeset.execute_update_vcs()

        assert_equal(
            self.changeset.commit_authors_per_locale[self.translated_locale.code],
            [first_author, second_author]
        )
开发者ID:MikkCZ,项目名称:pontoon,代码行数:40,代码来源:test_changeset.py

示例5: setUp

# 需要导入模块: from pontoon.base.tests import UserFactory [as 别名]
# 或者: from pontoon.base.tests.UserFactory import create_batch [as 别名]
 def setUp(self):
     self.user0, self.user1 = UserFactory.create_batch(2)
开发者ID:m8ttyB,项目名称:pontoon,代码行数:4,代码来源:test_models.py


注:本文中的pontoon.base.tests.UserFactory.create_batch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。