# coding=utf-8

import factory
from meal.models import Ingredient, Allergy


class IngredientFactory(factory.DjangoModelFactory):
    class Meta:
        model = Ingredient

    name = "Tomato"

    @classmethod
    def __init__(self, **kwargs):
        name = kwargs.pop('name', None)
        ingredients = super(IngredientFactory, self).__init__(self, **kwargs)
        ingredients.save()


class AllergyFactory(factory.DjangoModelFactory):
    class Meta:
        model = Allergy

    name = "Tomato"
    description = "A Simple Tomato"

    @classmethod
    def __init__(self, **kwargs):
        name = kwargs.pop("name", None)
        allergy = super(AllergyFactory, self).__init__(self, **kwargs)
        allergy.save()

@@ -62,17 +62,8 @@
 ient
-, Allergy
 %0A%0A%0Ac
@@ -379,339 +379,4 @@
 e()%0A
-%0A%0Aclass AllergyFactory(factory.DjangoModelFactory):%0A    class Meta:%0A        model = Allergy%0A%0A    name = %22Tomato%22%0A    description = %22A Simple Tomato%22%0A%0A    @classmethod%0A    def __init__(self, **kwargs):%0A        name = kwargs.pop(%22name%22, None)%0A        allergy = super(AllergyFactory, self).__init__(self, **kwargs)%0A        allergy.save()%0A

remove spurious AllergyFactory