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


Python OpenEdXInstanceFactory.set_to_branch_tip方法代码示例

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


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

示例1: test_set_to_branch_tip_replace_commit_hash

# 需要导入模块: from instance.tests.models.factories.instance import OpenEdXInstanceFactory [as 别名]
# 或者: from instance.tests.models.factories.instance.OpenEdXInstanceFactory import set_to_branch_tip [as 别名]
 def test_set_to_branch_tip_replace_commit_hash(self, mock_get_commit_id_from_ref):
     """
     The hash should be updated in the instance name when updating
     """
     mock_get_commit_id_from_ref.return_value = '1234567' + 'd' * 33
     instance = OpenEdXInstanceFactory(commit_id='a' * 40, name='Test Instance (aaaaaaa)')
     instance.set_to_branch_tip(branch_name='new-branch', ref_type='tag')
     self.assertEqual(instance.name, 'Test Instance (1234567)')
开发者ID:regisb,项目名称:opencraft,代码行数:10,代码来源:test_instance.py

示例2: test_set_to_branch_tip_extra_args

# 需要导入模块: from instance.tests.models.factories.instance import OpenEdXInstanceFactory [as 别名]
# 或者: from instance.tests.models.factories.instance.OpenEdXInstanceFactory import set_to_branch_tip [as 别名]
 def test_set_to_branch_tip_extra_args(self, mock_get_commit_id_from_ref):
     """
     Set the commit id to the tip of a specified reference
     """
     mock_get_commit_id_from_ref.return_value = 'c' * 40
     instance = OpenEdXInstanceFactory(commit_id='a' * 40)
     instance.set_to_branch_tip(branch_name='new-branch', ref_type='tag')
     self.assertEqual(instance.commit_id, 'c' * 40)
     self.assertEqual(instance.branch_name, 'new-branch')
     self.assertEqual(instance.ref_type, 'tag')
开发者ID:regisb,项目名称:opencraft,代码行数:12,代码来源:test_instance.py

示例3: test_set_to_branch_tip_no_commit

# 需要导入模块: from instance.tests.models.factories.instance import OpenEdXInstanceFactory [as 别名]
# 或者: from instance.tests.models.factories.instance.OpenEdXInstanceFactory import set_to_branch_tip [as 别名]
    def test_set_to_branch_tip_no_commit(self, mock_get_commit_id_from_ref):
        """
        Set the commit id to the tip of the current branch, with commit=False
        """
        mock_get_commit_id_from_ref.return_value = 'b' * 40
        instance = OpenEdXInstanceFactory(commit_id='a' * 40)
        instance.set_to_branch_tip(commit=False)
        self.assertEqual(instance.commit_id, 'b' * 40)

        # Check values in DB
        db_instance = OpenEdXInstance.objects.get(pk=instance.pk)
        self.assertEqual(db_instance.commit_id, 'a' * 40)
开发者ID:regisb,项目名称:opencraft,代码行数:14,代码来源:test_instance.py

示例4: test_set_to_branch_tip_commit

# 需要导入模块: from instance.tests.models.factories.instance import OpenEdXInstanceFactory [as 别名]
# 或者: from instance.tests.models.factories.instance.OpenEdXInstanceFactory import set_to_branch_tip [as 别名]
    def test_set_to_branch_tip_commit(self, mock_get_commit_id_from_ref):
        """
        Set the commit id to the tip of the current branch, using the default commit policy (True)
        """
        mock_get_commit_id_from_ref.return_value = 'b' * 40
        instance = OpenEdXInstanceFactory(
            github_organization_name='org3',
            github_repository_name='repo3',
            commit_id='a' * 40,
        )
        instance.set_to_branch_tip()
        self.assertEqual(instance.commit_id, 'b' * 40)
        self.assertEqual(mock_get_commit_id_from_ref.mock_calls, [
            call('org3/repo3', 'master', ref_type='heads'),
        ])

        # Check values in DB
        db_instance = OpenEdXInstance.objects.get(pk=instance.pk)
        self.assertEqual(db_instance.commit_id, 'b' * 40)
开发者ID:regisb,项目名称:opencraft,代码行数:21,代码来源:test_instance.py


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