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


Python factory.SubFactory方法代码示例

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


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

示例1: GitHubSummaryUser

# 需要导入模块: import factory [as 别名]
# 或者: from factory import SubFactory [as 别名]
def GitHubSummaryUser(session):
    class _GitHubSummaryUserFactory(factory.alchemy.SQLAlchemyModelFactory):
        class Meta:
            model = github_summary_user_model
            sqlalchemy_session_persistence = "commit"
            sqlalchemy_session = session

        slack_id = "slack_user"
        github_id = "13242345435"
        github_username = "github_user"
        github_state = ""
        github_access_token = factory.Faker("uuid4")
        configuration = factory.SubFactory(GitHubSummaryConfiguration(session))

    return _GitHubSummaryUserFactory 
开发者ID:busy-beaver-dev,项目名称:busy-beaver,代码行数:17,代码来源:github_summary_user.py

示例2: GitHubSummaryConfiguration

# 需要导入模块: import factory [as 别名]
# 或者: from factory import SubFactory [as 别名]
def GitHubSummaryConfiguration(session):
    class _GitHubSummaryConfiguration(factory.alchemy.SQLAlchemyModelFactory):
        class Meta:
            model = github_summary_configuration_model
            sqlalchemy_session_persistence = "commit"
            sqlalchemy_session = session

        channel = "busy-beaver"
        time_to_post = "2:00pm"
        timezone_info = {}
        slack_installation = factory.SubFactory(SlackInstallation(session))

    return _GitHubSummaryConfiguration 
开发者ID:busy-beaver-dev,项目名称:busy-beaver,代码行数:15,代码来源:github_summary_user.py

示例3: SlackUser

# 需要导入模块: import factory [as 别名]
# 或者: from factory import SubFactory [as 别名]
def SlackUser(session):
    class _SlackUserFactory(factory.alchemy.SQLAlchemyModelFactory):
        class Meta:
            model = slack_user_model
            sqlalchemy_session_persistence = "commit"
            sqlalchemy_session = session

        installation = factory.SubFactory(SlackInstallation(session))
        slack_id = "user_id"

    return _SlackUserFactory 
开发者ID:busy-beaver-dev,项目名称:busy-beaver,代码行数:13,代码来源:slack.py

示例4: moderators

# 需要导入模块: import factory [as 别名]
# 或者: from factory import SubFactory [as 别名]
def moderators(self, create, extracted, **kwargs):
        if not extracted:
            user_factory = factory.SubFactory(USER_FACTORY).get_factory()
            self.moderators.add(user_factory())
            return

        if extracted:
            for user in extracted:
                self.moderators.add(user) 
开发者ID:liqd,项目名称:adhocracy4,代码行数:11,代码来源:__init__.py

示例5: __new__

# 需要导入模块: import factory [as 别名]
# 或者: from factory import SubFactory [as 别名]
def __new__(mcs, class_name, bases, attrs):
        # Add the form field definitions to allow nested calls
        field_factory = attrs.pop('field_factory', None)
        if field_factory:
            wrapped_factories = {
                k: factory.SubFactory(AnswerFactory, sub_factory=v)
                for k, v in field_factory.factories.items()
                if issubclass(v, FormFieldBlockFactory)
            }
            attrs.update(wrapped_factories)
        return super().__new__(mcs, class_name, bases, attrs) 
开发者ID:OpenTechFund,项目名称:hypha,代码行数:13,代码来源:factories.py

示例6: _create

# 需要导入模块: import factory [as 别名]
# 或者: from factory import SubFactory [as 别名]
def _create(cls, model_class, *args, **kwargs):
        """ Create a corresponding user whenever we make a Participant.

        Each Participant stores the ID of its user, but it's not truly a
        foreign key, since the row resides in another database. Accordingly,
        we cannot use a SubFactory for the User object.
        """
        if not kwargs.pop('_disable_auto_user_creation', False):
            user = UserFactory.create(email=kwargs['email'])
            kwargs['user_id'] = user.pk

        return super()._create(model_class, *args, **kwargs) 
开发者ID:DavidCain,项目名称:mitoc-trips,代码行数:14,代码来源:factories.py


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