Add a subclass-implementation of the UserStateClient tests
This commit is contained in:
@@ -392,11 +392,11 @@ class UserStateCache(object):
|
||||
|
||||
Returns: datetime if there was a modified date, or None otherwise
|
||||
"""
|
||||
return self._client.get_mod_date(
|
||||
return self._client.get(
|
||||
self.user.username,
|
||||
kvs_key.block_scope_id,
|
||||
fields=[kvs_key.field_name],
|
||||
).get(kvs_key.field_name)
|
||||
).updated
|
||||
|
||||
@contract(kv_dict="dict(DjangoKeyValueStore_Key: *)")
|
||||
def set_many(self, kv_dict):
|
||||
|
||||
67
lms/djangoapps/courseware/tests/test_user_state_client.py
Normal file
67
lms/djangoapps/courseware/tests/test_user_state_client.py
Normal file
@@ -0,0 +1,67 @@
|
||||
"""
|
||||
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
|
||||
|
||||
def _user(self, user_idx):
|
||||
return self.users[user_idx].username
|
||||
|
||||
def _block_type(self, block): # pylint: disable=unused-argument
|
||||
# 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
|
||||
@@ -55,7 +55,7 @@ git+https://github.com/edx/edx-lint.git@ed8c8d2a0267d4d42f43642d193e25f8bd575d9b
|
||||
-e git+https://github.com/edx-solutions/xblock-google-drive.git@138e6fa0bf3a2013e904a085b9fed77dab7f3f21#egg=xblock-google-drive
|
||||
-e git+https://github.com/edx/edx-reverification-block.git@485c189f4c5d9ad34e8856e385be546c0ad0a9aa#egg=edx-reverification-block
|
||||
git+https://github.com/edx/ecommerce-api-client.git@1.1.0#egg=ecommerce-api-client==1.1.0
|
||||
-e git+https://github.com/edx/edx-user-state-client.git@64a8b603f42669bb7fdca03d364d4e8d3d6ad67d#egg=edx-user-state-client
|
||||
-e git+https://github.com/edx/edx-user-state-client.git@30c0ad4b9f57f8d48d6943eb585ec8a9205f4469#egg=edx-user-state-client
|
||||
-e git+https://github.com/edx/edx-proctoring.git@release-2015-07-29#egg=edx-proctoring
|
||||
|
||||
# Third Party XBlocks
|
||||
|
||||
Reference in New Issue
Block a user