This abstract class contains most of the fields (aside from the id and foreign key to StudentModule that the subclasses need to manage). It also provides a get_history method that abstracts searching across multiple backends. Move router code to openedx/core We need to use it from cms and lms. Ensure aws_migrate can be used for migrating both the lms and cms. Handle queries directed to student_module_history vs default and the extra queries generated by Django 1.8 (SAVEPOINTS, etc). Additionally, flag testing classes as multi_db so that Django will flush the non-default database between unit tests. Further decouple the foreignkey relation between csm and csmhe When calling StudentModule().delete() Django will try to delete CSMHE objects, but naively does so in the database, not by consulting the database router. Instead, we disable django cascading deletes and listen for post_delete signals and clean up CSMHE by hand. Add feature flags for CSMHE One to turn it on/off so we can control the deploy. The other will control whether or not we read from two database tables or one when searching. Update tests to explicitly use this get_history method rather than looking directly into StudentModuleHistory or StudentModuleHistoryExtended. Inform lettuce to avoid the coursewarehistoryextended app Otherwise it fails when it can't find features/ in that app. Add Pg support, this is not tested automatically.
70 lines
2.1 KiB
Python
70 lines
2.1 KiB
Python
"""
|
|
Black-box tests of the DjangoUserStateClient against the semantics
|
|
defined in edx_user_state_client.
|
|
"""
|
|
|
|
from collections import defaultdict
|
|
from unittest import skip
|
|
|
|
from django.test import TestCase
|
|
|
|
from edx_user_state_client.tests import UserStateClientTestBase
|
|
from courseware.user_state_client import DjangoXBlockUserStateClient
|
|
from courseware.tests.factories import UserFactory
|
|
|
|
|
|
class TestDjangoUserStateClient(UserStateClientTestBase, TestCase):
|
|
"""
|
|
Tests of the DjangoUserStateClient backend.
|
|
"""
|
|
__test__ = True
|
|
# Tell Django to clean out all databases, not just default
|
|
multi_db = True
|
|
|
|
def _user(self, user_idx):
|
|
return self.users[user_idx].username
|
|
|
|
def _block_type(self, block):
|
|
# We only record block state history in DjangoUserStateClient
|
|
# when the block type is 'problem'
|
|
return 'problem'
|
|
|
|
def setUp(self):
|
|
super(TestDjangoUserStateClient, self).setUp()
|
|
self.client = DjangoXBlockUserStateClient()
|
|
self.users = defaultdict(UserFactory.create)
|
|
|
|
# We're skipping these tests because the iter_all_by_block and iter_all_by_course
|
|
# are not implemented in the DjangoXBlockUserStateClient
|
|
@skip("Not supported by DjangoXBlockUserStateClient")
|
|
def test_iter_blocks_deleted_block(self):
|
|
pass
|
|
|
|
@skip("Not supported by DjangoXBlockUserStateClient")
|
|
def test_iter_blocks_empty(self):
|
|
pass
|
|
|
|
@skip("Not supported by DjangoXBlockUserStateClient")
|
|
def test_iter_blocks_many_users(self):
|
|
pass
|
|
|
|
@skip("Not supported by DjangoXBlockUserStateClient")
|
|
def test_iter_blocks_single_user(self):
|
|
pass
|
|
|
|
@skip("Not supported by DjangoXBlockUserStateClient")
|
|
def test_iter_course_deleted_block(self):
|
|
pass
|
|
|
|
@skip("Not supported by DjangoXBlockUserStateClient")
|
|
def test_iter_course_empty(self):
|
|
pass
|
|
|
|
@skip("Not supported by DjangoXBlockUserStateClient")
|
|
def test_iter_course_single_user(self):
|
|
pass
|
|
|
|
@skip("Not supported by DjangoXBlockUserStateClient")
|
|
def test_iter_course_many_users(self):
|
|
pass
|