import time

import factory
from factory import fuzzy

from fjord.heartbeat.models import Answer, Survey


class SurveyFactory(factory.DjangoModelFactory):
    class Meta:
        model = Survey

    name = fuzzy.FuzzyText(length=100)
    enabled = True


class AnswerFactory(factory.DjangoModelFactory):
    class Meta:
        model = Answer

    experiment_version = '1'
    response_version = 1
    updated_ts = int(time.time())
    survey_id = factory.SubFactory(SurveyFactory)
    flow_id = fuzzy.FuzzyText(length=50)
    question_id = fuzzy.FuzzyText(length=50)

    # The rest of the fields aren't required and should have sane
    # defaults.

import time

import factory

from fjord.heartbeat.models import Answer, Survey


class SurveyFactory(factory.DjangoModelFactory):
    class Meta:
        model = Survey

    name = 'survey123'
    enabled = True


class AnswerFactory(factory.DjangoModelFactory):
    class Meta:
        model = Answer

    experiment_version = '1'
    response_version = 1
    updated_ts = int(time.time())
    survey_id = factory.SubFactory(SurveyFactory)
    flow_id = 'flowabc'
    question_id = 'questionabc'

    # The rest of the fields aren't required and should have sane
    # defaults.

--- 
+++ 
@@ -1,6 +1,7 @@
 import time
 
 import factory
+from factory import fuzzy
 
 from fjord.heartbeat.models import Answer, Survey
 
@@ -9,7 +10,7 @@
     class Meta:
         model = Survey
 
-    name = 'survey123'
+    name = fuzzy.FuzzyText(length=100)
     enabled = True
 
 
@@ -21,8 +22,8 @@
     response_version = 1
     updated_ts = int(time.time())
     survey_id = factory.SubFactory(SurveyFactory)
-    flow_id = 'flowabc'
-    question_id = 'questionabc'
+    flow_id = fuzzy.FuzzyText(length=50)
+    question_id = fuzzy.FuzzyText(length=50)
 
     # The rest of the fields aren't required and should have sane
     # defaults.
Change some fields to use fuzzy values

This makes it easier to have tests generate multiple surveys and
answers without hitting integrity issues.
