def data():
    m = type("Models", (object, ), {})

    m.registered_user = f.UserFactory.create()
    m.project_owner = f.UserFactory.create()

    m.project1 = f.ProjectFactory(is_private=True,
                                  anon_permissions=[],
                                  public_permissions=[],
                                  owner=m.project_owner)
    m.project2 = f.ProjectFactory(is_private=True,
                                  anon_permissions=[],
                                  public_permissions=[],
                                  owner=m.project_owner)

    f.MembershipFactory(project=m.project1,
                        user=m.project_owner,
                        is_owner=True)

    m.webhook1 = f.WebhookFactory(project=m.project1)
    m.webhooklog1 = f.WebhookLogFactory(webhook=m.webhook1)
    m.webhook2 = f.WebhookFactory(project=m.project2)
    m.webhooklog2 = f.WebhookLogFactory(webhook=m.webhook2)

    return m
Example #2
0
def data():
    m = type("Models", (object, ), {})

    m.registered_user = f.UserFactory.create()
    m.project_owner = f.UserFactory.create()

    m.project1 = f.ProjectFactory(is_private=True,
                                  anon_permissions=[],
                                  public_permissions=[],
                                  owner=m.project_owner)
    m.project2 = f.ProjectFactory(is_private=True,
                                  anon_permissions=[],
                                  public_permissions=[],
                                  owner=m.project_owner)
    m.blocked_project = f.ProjectFactory(
        is_private=True,
        anon_permissions=[],
        public_permissions=[],
        owner=m.project_owner,
        blocked_code=project_choices.BLOCKED_BY_STAFF)

    f.MembershipFactory(project=m.project1,
                        user=m.project_owner,
                        is_admin=True)
    f.MembershipFactory(project=m.blocked_project,
                        user=m.project_owner,
                        is_admin=True)

    m.webhook1 = f.WebhookFactory(project=m.project1)
    m.webhooklog1 = f.WebhookLogFactory(webhook=m.webhook1)
    m.webhook2 = f.WebhookFactory(project=m.project2)
    m.webhooklog2 = f.WebhookLogFactory(webhook=m.webhook2)
    m.blocked_webhook = f.WebhookFactory(project=m.blocked_project)
    m.blocked_webhooklog = f.WebhookLogFactory(webhook=m.blocked_webhook)

    return m