Example #1
0
def collection_batch_no_projects():
    """Create and commit a batch of Collection instances
    without projects, for testing the update API - we cannot
    assign projects to collections, only the other way around."""
    collections = [CollectionFactory() for _ in range(randint(3, 5))]
    for collection in collections:
        ClientFactory.create_batch(randint(0, 3), collection=collection)
        RoleFactory.create_batch(randint(0, 3), collection=collection)
    return collections
Example #2
0
def collection_batch():
    """Create and commit a batch of Collection instances,
    with associated projects, clients and roles."""
    collections = [CollectionFactory() for _ in range(randint(3, 5))]
    ProjectFactory.create_batch(randint(0, 3), collections=collections)
    for collection in collections:
        ClientFactory.create_batch(randint(0, 3), collection=collection)
        RoleFactory.create_batch(randint(0, 3), collection=collection)
    return collections