Ejemplo n.º 1
0
def test_forms(settings):
    shop = get_default_shop()

    # check whether the fields are dynamically added
    manager.clear_installed_samples(shop)
    consolidate_form = ConsolidateObjectsForm(**{"shop":shop})
    assert len(consolidate_form.fields) == 0

    # field categories appears
    categories = [CategoryFactory().pk, CategoryFactory().pk, CategoryFactory().pk]
    manager.save_categories(shop, categories)
    consolidate_form = ConsolidateObjectsForm(**{"shop":shop})
    assert "categories" in consolidate_form.fields

    # field products appears
    products = [ProductFactory().pk, ProductFactory().pk, ProductFactory().pk]
    manager.save_products(shop, products)
    consolidate_form = ConsolidateObjectsForm(**{"shop":shop})
    assert "products" in consolidate_form.fields

    # field carousel appears
    carousel = Carousel.objects.create(name="stuff")
    manager.save_carousel(shop, carousel.pk)
    consolidate_form = ConsolidateObjectsForm(**{"shop":shop})
    assert "carousel" in consolidate_form.fields
Ejemplo n.º 2
0
 def populate_samples():
     manager.clear_installed_samples(shop)
     categories = [CategoryFactory().pk, CategoryFactory().pk, CategoryFactory().pk]
     products = [ProductFactory().pk, ProductFactory().pk, ProductFactory().pk, ProductFactory().pk]
     carousel = Carousel.objects.create(name="crazy stuff").pk
     manager.save_categories(shop, categories)
     manager.save_products(shop, products)
     manager.save_carousel(shop, carousel)