-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure drivers loaded before failing
so that deprecated are known PLAT-132
- Loading branch information
Don Mitchell
committed
Oct 9, 2014
1 parent
af629a1
commit 6ade2a8
Showing
3 changed files
with
58 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
Test that old keys deserialize just by importing opaque keys | ||
""" | ||
from unittest import TestCase | ||
from opaque_keys.edx.keys import CourseKey, UsageKey | ||
|
||
|
||
class TestDefault(TestCase): | ||
""" | ||
Check that clients which merely import CourseKey can deserialize the expected keys, etc | ||
""" | ||
def test_course_key(self): | ||
""" | ||
Test CourseKey | ||
""" | ||
CourseKey.LOADED_DRIVERS.clear() | ||
key = CourseKey.from_string('org.id/course_id/run') | ||
self.assertEqual(key.org, 'org.id') | ||
|
||
key = CourseKey.from_string('course-v1:org.id+course_id+run') | ||
self.assertEqual(key.org, 'org.id') | ||
|
||
def test_usage_key(self): | ||
""" | ||
Test UsageKey | ||
""" | ||
UsageKey.LOADED_DRIVERS.clear() | ||
key = UsageKey.from_string('i4x://org.id/course_id/category/block_id') | ||
self.assertEqual(key.block_id, 'block_id') | ||
|
||
key = UsageKey.from_string('block-v1:org.id+course_id+run+type@category+block@block_id') | ||
self.assertEqual(key.block_id, 'block_id') |