<s> import factory <EOL> from factory . django import DjangoModelFactory <EOL> from ralph . operations . models import ( <EOL> Change , <EOL> Failure , <EOL> Incident , <EOL> Operation , <EOL> OperationStatus , <EOL> OperationType , <EOL> Problem <EOL> ) <EOL> def get_operation_type ( name ) : <EOL> return OperationType . objects . get ( name = name ) <EOL> class OperationFactory ( DjangoModelFactory ) : <EOL> title = factory . Sequence ( lambda n : '<STR_LIT>' % n ) <EOL> status = OperationStatus . opened <EOL> type = factory . LazyAttribute ( lambda obj : get_operation_type ( '<STR_LIT>' ) ) <EOL> class Meta : <EOL> model = Operation <EOL> class ChangeFactory ( OperationFactory ) : <EOL> class Meta : <EOL> model = Change <EOL> class FailureFactory ( OperationFactory ) : <EOL> type = factory . LazyAttribute ( lambda obj : get_operation_type ( '<STR_LIT>' ) ) <EOL> class Meta : <EOL> model = Failure <EOL> class ProblemFactory ( OperationFactory ) : <EOL> type = factory . LazyAttribute ( lambda obj : get_operation_type ( '<STR_LIT>' ) ) <EOL> class Meta : <EOL> model = Problem <EOL> class IncidentFactory ( OperationFactory ) : <EOL> type = factory . LazyAttribute ( lambda obj : get_operation_type ( '<STR_LIT>' ) ) <EOL> class Meta : <EOL> model = Incident </s>
