Commit 0426761b by Jay Zoldak

Update lettuce and factory-boy versions.

parent 8a852f90
......@@ -2,17 +2,17 @@ from student.models import (User, UserProfile, Registration,
CourseEnrollmentAllowed, CourseEnrollment)
from django.contrib.auth.models import Group
from datetime import datetime
from factory import Factory, SubFactory, post_generation
from factory import DjangoModelFactory, Factory, SubFactory, PostGenerationMethodCall
from uuid import uuid4
class GroupFactory(Factory):
class GroupFactory(DjangoModelFactory):
FACTORY_FOR = Group
name = 'staff_MITx/999/Robot_Super_Course'
class UserProfileFactory(Factory):
class UserProfileFactory(DjangoModelFactory):
FACTORY_FOR = UserProfile
user = None
......@@ -23,19 +23,20 @@ class UserProfileFactory(Factory):
goals = 'World domination'
class RegistrationFactory(Factory):
class RegistrationFactory(DjangoModelFactory):
FACTORY_FOR = Registration
user = None
activation_key = uuid4().hex
class UserFactory(Factory):
class UserFactory(DjangoModelFactory):
FACTORY_FOR = User
username = 'robot'
email = 'robot+test@edx.org'
password = 'test'
password = PostGenerationMethodCall('set_password',
'test')
first_name = 'Robot'
last_name = 'Test'
is_staff = False
......@@ -44,26 +45,21 @@ class UserFactory(Factory):
last_login = datetime(2012, 1, 1)
date_joined = datetime(2011, 1, 1)
@post_generation
def set_password(self, create, extracted, **kwargs):
self._raw_password = self.password
self.set_password(self.password)
if create:
self.save()
class AdminFactory(Factory):
FACTORY_FOR = User
class AdminFactory(UserFactory):
is_staff = True
class CourseEnrollmentFactory(Factory):
class CourseEnrollmentFactory(DjangoModelFactory):
FACTORY_FOR = CourseEnrollment
user = SubFactory(UserFactory)
course_id = 'edX/toy/2012_Fall'
class CourseEnrollmentAllowedFactory(Factory):
class CourseEnrollmentAllowedFactory(DjangoModelFactory):
FACTORY_FOR = CourseEnrollmentAllowed
email = 'test@edx.org'
......
......@@ -61,8 +61,8 @@ sphinx==1.1.3
# Used for testing
coverage==3.6
factory_boy==1.3.0
lettuce==0.2.15
factory_boy==2.0.2
lettuce==0.2.16
mock==0.8.0
nosexcover==1.0.7
pep8==1.4.5
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment