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


Python RecipeFactory.create_batch方法代码示例

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


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

示例1: test_recipes_used_by

# 需要导入模块: from normandy.recipes.tests import RecipeFactory [as 别名]
# 或者: from normandy.recipes.tests.RecipeFactory import create_batch [as 别名]
    def test_recipes_used_by(self):
        recipe = RecipeFactory(enabled=True)
        assert [recipe] == list(recipe.action.recipes_used_by)

        action = ActionFactory()
        recipes = RecipeFactory.create_batch(2, action=action, enabled=True)
        assert set(action.recipes_used_by) == set(recipes)
开发者ID:chartjes,项目名称:normandy,代码行数:9,代码来源:test_models.py

示例2: test_update_signatures

# 需要导入模块: from normandy.recipes.tests import RecipeFactory [as 别名]
# 或者: from normandy.recipes.tests.RecipeFactory import create_batch [as 别名]
 def test_update_signatures(self, mocker):
     # Make sure the test environment is clean. This test is invalid otherwise.
     assert Recipe.objects.all().count() == 0
     # Mock the Autographer
     mock_autograph = mocker.patch('normandy.recipes.models.Autographer')
     mock_autograph.return_value.sign_data.return_value = [
         {'signature': 'fake signature 1'},
         {'signature': 'fake signature 2'},
     ]
     # Make and sign two recipes
     RecipeFactory.create_batch(2)
     Recipe.objects.all().update_signatures()
     # Assert the autographer was used as expected
     assert mock_autograph.called
     assert mock_autograph.return_value.sign_data.called_with([Whatever(), Whatever()])
     signatures = list(Recipe.objects.all().values_list('signature__signature', flat=True))
     assert signatures == ['fake signature 1', 'fake signature 2']
开发者ID:chartjes,项目名称:normandy,代码行数:19,代码来源:test_models.py

示例3: test_recipes_used_by

# 需要导入模块: from normandy.recipes.tests import RecipeFactory [as 别名]
# 或者: from normandy.recipes.tests.RecipeFactory import create_batch [as 别名]
    def test_recipes_used_by(self):
        approver = UserFactory()
        enabler = UserFactory()
        recipe = RecipeFactory(approver=approver, enabler=enabler)
        assert [recipe] == list(recipe.action.recipes_used_by)

        action = ActionFactory()
        recipes = RecipeFactory.create_batch(2, action=action, approver=approver, enabler=enabler)
        assert set(action.recipes_used_by) == set(recipes)
开发者ID:rehandalal,项目名称:normandy,代码行数:11,代码来源:test_models.py

示例4: test_recipes_used_by_empty

# 需要导入模块: from normandy.recipes.tests import RecipeFactory [as 别名]
# 或者: from normandy.recipes.tests.RecipeFactory import create_batch [as 别名]
    def test_recipes_used_by_empty(self):
        assert list(ActionFactory().recipes_used_by) == []

        action = ActionFactory()
        RecipeFactory.create_batch(2, action=action, enabled=False)
        assert list(action.recipes_used_by) == []
开发者ID:chartjes,项目名称:normandy,代码行数:8,代码来源:test_models.py


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