mirror of
https://github.com/coursera-dl/coursera-dl.git
synced 2026-07-28 13:34:03 +00:00
Update tests
This commit is contained in:
parent
71b1d643c9
commit
cbe72da11a
2 changed files with 7 additions and 4 deletions
|
|
@ -13,6 +13,7 @@ from six import iteritems
|
|||
from mock import patch, Mock, mock_open
|
||||
|
||||
from coursera import coursera_dl
|
||||
from coursera import api
|
||||
|
||||
|
||||
# JSon Handling
|
||||
|
|
@ -116,7 +117,7 @@ def test_parse(get_old_style_video, filename, num_sections, num_lectures,
|
|||
assert sum(r for f, r in resources if f == "mp4") == num_videos
|
||||
|
||||
|
||||
@patch('coursera.coursera_dl.get_page')
|
||||
@patch('coursera.api.get_page')
|
||||
def test_get_on_demand_supplement_url_accumulates_assets(mocked):
|
||||
input = open(
|
||||
os.path.join(os.path.dirname(__file__),
|
||||
|
|
@ -125,8 +126,8 @@ def test_get_on_demand_supplement_url_accumulates_assets(mocked):
|
|||
os.path.join(os.path.dirname(__file__),
|
||||
"fixtures", "json", "supplement-multiple-assets-output.json")))
|
||||
mocked.return_value = input
|
||||
output = coursera_dl.get_on_demand_supplement_url(
|
||||
'session', 'course_id', 'element_id')
|
||||
course = api.CourseraOnDemand(session=None, course_json={'id': 0})
|
||||
output = course.extract_files_from_supplement('element_id')
|
||||
|
||||
# This is the easiest way to convert nested tuples to lists
|
||||
output = json.loads(json.dumps(output))
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import six
|
|||
from mock import Mock
|
||||
from coursera import utils
|
||||
from coursera import coursera_dl
|
||||
from coursera import api
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
@ -230,7 +231,8 @@ def test_extract_supplement_links(input, output):
|
|||
page_text = open(input_filename).read()
|
||||
expected_output = json.load(open(output_filename))
|
||||
|
||||
output = utils.extract_supplement_links(page_text)
|
||||
course = api.CourseraOnDemand(session=None, course_json={'id': 0})
|
||||
output = course._extract_supplement_links(page_text)
|
||||
# This is the easiest way to convert nested tuples to lists
|
||||
output = json.loads(json.dumps(output))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue