Example #1
0
async def test_download_rename(client: ilmsdump.Client):
    assert data.ATTACHMENT_2616322.suggest_filename() == 'meta_.json'
    assert data.ATTACHMENT_2616322.get_meta()['saved_filename'] == 'meta_.json'

    assert [c async for c in data.ATTACHMENT_2616322.download(client)] == []

    assert not (client.get_dir_for(data.ATTACHMENT_2616322) / 'meta.json').exists()
    assert (client.get_dir_for(data.ATTACHMENT_2616322) / 'meta_.json').exists()
Example #2
0
async def test_download(client: ilmsdump.Client):
    assert [c async for c in data.ATTACHMENT_2616319.download(client)] == []

    file = client.get_dir_for(data.ATTACHMENT_2616319) / 'announcement.txt'
    assert file.read_text(encoding='utf8') == ATTACHMENT_2616319_CONTENT

    assert client.bytes_downloaded == file.stat().st_size
Example #3
0
async def test_download(client: ilmsdump.Client):
    assert [
        a async for a in ilmsdump.GroupList(data.COURSE_46274).download(client)
    ] == []

    assert (client.get_dir_for(ilmsdump.GroupList(data.COURSE_46274)) /
            'index.html').exists()
Example #4
0
async def test_download(client: ilmsdump.Client):
    # XXX: Not actually downloading a score table
    assert [a async for a in ilmsdump.Score(data.COURSE_74).download(client)
            ] == []

    assert (client.get_dir_for(ilmsdump.Score(data.COURSE_74)) /
            'index.html').exists()
Example #5
0
async def test_downlaod(client: ilmsdump.Client):
    attachments = [a async for a in data.DISCUSSION_258543.download(client)]

    assert (client.get_dir_for(data.DISCUSSION_258543) / 'index.json').exists()

    assert data.ATTACHMENT_2134734 in attachments
    assert data.ATTACHMENT_2134738 in attachments
Example #6
0
async def test_download_with_submissions(client: ilmsdump.Client):
    attachments = [a async for a in data.HOMEWORK_182409.download(client)]

    assert (client.get_dir_for(data.HOMEWORK_182409) / 'index.html').exists()

    assert len(attachments) >= 50
    assert all(isinstance(a, ilmsdump.SubmittedHomework) for a in attachments)
Example #7
0
async def test_download(client: ilmsdump.Client):
    attachments = [a async for a in data.HOMEWORK_201015.download(client)]

    assert (client.get_dir_for(data.HOMEWORK_201015) / 'index.html').exists()

    assert attachments == [
        data.ATTACHMENT_2038513,
        data.ATTACHMENT_2047732,
    ]
Example #8
0
async def test_download(client: ilmsdump.Client):
    assert [c async for c in data.VIDEO_1518.download(client)] == []

    file = client.get_dir_for(data.VIDEO_1518) / 'video.mp4'
    b = file.read_bytes()
    assert (hashlib.sha256(b).hexdigest() ==
            'c926d4375794d4a1b56cf5bc0f323dda10d45fbd3e93f2779b4f8af86f2d970d')

    assert client.bytes_downloaded == len(b)
Example #9
0
async def test_download_rename_illegal(client: ilmsdump.Client):
    attachment = dataclasses.replace(data.ATTACHMENT_2616322, title='>.<.txt')

    assert attachment.suggest_filename() == '_._.txt'
    assert attachment.get_meta()['saved_filename'] == '_._.txt'

    assert [c async for c in attachment.download(client)] == []

    # This is not testable on windows
    # assert not (client.get_dir_for(attachment) / '>.<.txt').exists()
    assert (client.get_dir_for(attachment) / '_._.txt').exists()
Example #10
0
async def test_downlaod(client: ilmsdump.Client):
    attachments = [a async for a in data.ANNOUNCEMENT_2218728.download(client)]

    assert (client.get_dir_for(data.ANNOUNCEMENT_2218728) /
            'index.json').exists()

    assert attachments == [
        data.ATTACHMENT_2616319,
        data.ATTACHMENT_2616320,
        data.ATTACHMENT_2616322,
    ]
Example #11
0
async def test_download(client: ilmsdump.Client):
    items = [i async for i in data.COURSE_40596.download(client)]

    assert (client.get_dir_for(data.COURSE_40596) / 'index.html').exists()

    assert data.ANNOUNCEMENT_2008652 in items
    assert data.ANNOUNCEMENT_2218728 in items
    assert data.DISCUSSION_258543 in items
    assert data.DISCUSSION_236608 in items
    assert data.MATERIAL_2173495 in items
    assert data.MATERIAL_2004666 in items
    assert data.HOMEWORK_198377 in items
    assert data.HOMEWORK_200355 in items
    assert data.GROUPLIST_40596 in items
Example #12
0
async def test_downlaod(client: ilmsdump.Client):
    attachments = [a async for a in data.MATERIAL_2173495.download(client)]

    assert (client.get_dir_for(data.MATERIAL_2173495) / 'index.html').exists()

    assert attachments == [data.ATTACHMENT_2107249]
Example #13
0
async def test_download_rename(client: ilmsdump.Client):
    assert [c async for c in data.ATTACHMENT_2616322.download(client)] == []

    assert not (client.get_dir_for(data.ATTACHMENT_2616322) / 'meta.json').exists()
    assert (client.get_dir_for(data.ATTACHMENT_2616322) / 'meta_.json').exists()
Example #14
0
async def test_get_open_courses(client: ilmsdump.Client):
    courses = [c async for c in client.get_open_courses(semester_id=38)]

    assert data.COURSE_40596 in courses
    assert len(courses) > 20
    assert all(isinstance(c, ilmsdump.Course) for c in courses)
Example #15
0
async def test_download(client: ilmsdump.Client):
    assert [a async for a in data.SUBMITTED_2474481.download(client)
            ] == [data.ATTACHMENT_2406879]

    assert (client.get_dir_for(data.SUBMITTED_2474481) / 'index.html').exists()
Example #16
0
async def test_group_download(client: ilmsdump.Client):
    assert [a async for a in data.SUBMITTED_59376.download(client)
            ] == [data.ATTACHMENT_49113]

    assert (client.get_dir_for(data.SUBMITTED_59376) / 'index.html').exists()
Example #17
0
async def test_download_multiple_div_id_main(client: ilmsdump.Client):
    # just make sure it runs
    [a async for a in data.HOMEWORK_183084.download(client)]

    assert (client.get_dir_for(data.HOMEWORK_183084) / 'index.html').exists()
Example #18
0
async def test_downlaod_powercam(client: ilmsdump.Client):
    attachments = [a async for a in data.MATERIAL_1518.download(client)]

    assert (client.get_dir_for(data.MATERIAL_1518) / 'index.html').exists()

    assert attachments == [data.VIDEO_1518]