Esempio n. 1
0
def test_duplicates_number_older(temp_path: pathlib.Path, archive_file: pathlib.Path) -> None:
    runners.run_kodiak_init(temp_path, archive_file, 'h4', duplicates='number-older')
    lucy_path = temp_path / 'h4' / 'submissions' / 'Pelt_Lucy'
    lpelt_hw4_pdf = lucy_path / 'LPelt_HW4.pdf'
    lpelt_hw4_pdf_2 = lucy_path / 'LPelt_HW4 (2).pdf'
    assert lpelt_hw4_pdf.read_text() == 'newest'
    assert lpelt_hw4_pdf_2.read_text() == 'oldest'
Esempio n. 2
0
def test_no_opts(temp_path: pathlib.Path, archive_file: pathlib.Path) -> None:
    runners.run_kodiak_init(temp_path, archive_file, 'h4', duplicates=None)
    h4 = temp_path / 'h4'
    subs = h4/'submissions'
    assert listdir(subs) == ['Brown_Charlie', 'Pelt_Lucy']
    assert listdir(subs/'Brown_Charlie'/'CharlieB_HW4') == ['x', 'y', 'z']
    assert listdir(subs/'Brown_Charlie'/'CharlieB_HW4'/'z') == ['q']
    assert listdir(subs/'Pelt_Lucy') == ['LPelt_HW4 (1).pdf', 'LPelt_HW4 (2).pdf', 'LPelt_HW4.pdf']
    assert (h4/'.kodiak'/'sourceTargetMapping').exists()
    lucy_path = temp_path / 'h4' / 'submissions' / 'Pelt_Lucy'
    lpelt_hw4_pdf = lucy_path / 'LPelt_HW4.pdf'
    lpelt_hw4_pdf_2 = lucy_path / 'LPelt_HW4 (2).pdf'
    assert lpelt_hw4_pdf.read_text() == 'newest'
    assert lpelt_hw4_pdf_2.read_text() == 'oldest'
Esempio n. 3
0
def test_archive(temp_path: pathlib.Path, archive_file: pathlib.Path) -> None:
    runners.run_kodiak_init(temp_path,
                            archive_file,
                            'h4',
                            duplicates='number-older')

    pelt = temp_path / 'h4' / 'submissions' / 'Pelt_Lucy' / 'LPelt_HW4.pdf'
    pelt.write_text('feedback')

    runners.run_kodiak_archive(temp_path, 'h4')

    new_archive = (temp_path / 'h4' / 'gradedArchive' /
                   'Homework 4 Download May 25, 2018 1118 AM.zip')
    h4_1 = temp_path / 'h4_1'
    shutil.unpack_archive(str(new_archive), str(h4_1))
    pelt = h4_1 / '11824-66708 - Lucy Pelt - Feb 9, 2017 1017 PM - LPelt_HW4.pdf'
    assert pelt.read_text() == 'feedback'
Esempio n. 4
0
def test_duplicates_keep_oldest_only(temp_path: pathlib.Path, archive_file: pathlib.Path) -> None:
    runners.run_kodiak_init(temp_path, archive_file, 'h4', duplicates='oldest-only')
    lucyDir = temp_path / 'h4' / 'submissions' / 'Pelt_Lucy'
    assert len(listdir(lucyDir)) == 1
    assert (lucyDir / 'LPelt_HW4.pdf').read_text() == 'oldest'