Exemplo n.º 1
0
        def it_generates_a_unique_code():
            collection1 = Collection()
            collection2 = Collection()
            collection1.clean()
            collection2.clean()

            expect(collection1.code) != collection2.code
Exemplo n.º 2
0
        def it_sorts_by_key():
            objs = [
                Collection(key='1'),
                Collection(key='_'),
                Collection(key='a'),
            ]

            expect(sorted(objs)) == objs
Exemplo n.º 3
0
 def collection():
     c = Collection(name="Sample List")
     c.items = [
         Item(name="foo"),
         Item(name="bar"),
     ]
     return c
Exemplo n.º 4
0
 def collection():
     c = Collection(name="Sample")
     c.items = [
         Item(name="a"),
         Item(name="b"),
         Item(name="c"),
     ]
     return c
Exemplo n.º 5
0
def collection():
    collection = Collection(name="Sample List", key='_c', code='sample')
    collection.items = [
        Item(name="bar", key='_i1').save(),
        Item(name="foo", key='_i2').save(),
        Item(name="qux", key='_i3').save(),
    ]
    collection.vote("foo", "bar")
    collection.save()
    return collection
Exemplo n.º 6
0
        def it_generates_a_unique_key():
            collection1 = Collection()
            collection2 = Collection()

            expect(collection1.key) != collection2.key
Exemplo n.º 7
0
def collection2():
    collection = Collection(name="Sample List 2", key='_c2')
    collection.save()
    return collection
Exemplo n.º 8
0
#!/usr/bin/env python
# pylint: disable=import-error,line-too-long
"""
Generate sample data for manual testing.
"""

import os

from crowdsorter.settings import get_config
from crowdsorter.factory import create_app
from crowdsorter.models import Collection, Item, Redirect

create_app(get_config(os.getenv('FLASK_ENV') or 'dev'))

collection = Collection(name="Empty Collection", key='_empty')
collection.save()

collection = Collection(name="New Collection", key='_new')
collection.add("Foo")
collection.add("Bar")
collection.add("A really long name with lots of words.")
collection.add("special_character:#")
collection.add("special_character:&")
collection.add("special_character:'")
collection.save()

collection = Collection(name="Colors",
                        key='_sample',
                        code='sample',
                        private=True)
collection.add("Red")