Commit 54b0a465 by David Ormsbee

Ugly hack so that an LMS-specific test of the shared Student djangoapp doesn't break CMS test runs

parent e8ac66fc
...@@ -28,7 +28,9 @@ class ReplicationTest(TestCase): ...@@ -28,7 +28,9 @@ class ReplicationTest(TestCase):
portal_user.last_login=datetime(2012, 1, 1) portal_user.last_login=datetime(2012, 1, 1)
portal_user.date_joined=datetime(2011, 1, 1) portal_user.date_joined=datetime(2011, 1, 1)
# This is an Askbot field and will break if askbot is not included # This is an Askbot field and will break if askbot is not included
portal_user.seen_response_count = 10
if hasattr(portal_user, 'seen_response_count'):
portal_user.seen_response_count = 10
portal_user.save(using='default') portal_user.save(using='default')
...@@ -45,18 +47,23 @@ class ReplicationTest(TestCase): ...@@ -45,18 +47,23 @@ class ReplicationTest(TestCase):
field, portal_user, course_user field, portal_user, course_user
)) ))
# Since it's the first copy over of User data, we should have all of it if hasattr(portal_user, 'seen_response_count'):
self.assertEqual(portal_user.seen_response_count, # Since it's the first copy over of User data, we should have all of it
course_user.seen_response_count) self.assertEqual(portal_user.seen_response_count,
course_user.seen_response_count)
# But if we replicate again, the user already exists in the Course DB, # But if we replicate again, the user already exists in the Course DB,
# so it shouldn't update the seen_response_count (which is Askbot # so it shouldn't update the seen_response_count (which is Askbot
# controlled) # controlled).
portal_user.seen_response_count = 20 # This hasattr lameness is here because we don't want this test to be
replicate_user(portal_user, COURSE_1) # triggered when we're being run by CMS tests (Askbot doesn't exist
course_user = User.objects.using(COURSE_1).get(id=portal_user.id) # there, so the test will fail).
self.assertEqual(portal_user.seen_response_count, 20) if hasattr(portal_user, 'seen_response_count'):
self.assertEqual(course_user.seen_response_count, 10) portal_user.seen_response_count = 20
replicate_user(portal_user, COURSE_1)
course_user = User.objects.using(COURSE_1).get(id=portal_user.id)
self.assertEqual(portal_user.seen_response_count, 20)
self.assertEqual(course_user.seen_response_count, 10)
# Another replication should work for an email change however, since # Another replication should work for an email change however, since
# it's a field we care about. # it's a field we care about.
......
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