def test_create_section(name: str, course: Course) -> None: # Try and add the given section. section = course.create_section(name) assert is_valid_section(section) assert section['name'] == name # Try and delete the section created above. deleted_section = course.delete_section(section['id']) assert is_valid_section(deleted_section) assert deleted_section['id'] == section['id']
def test_create_sections(names: List[str], course: Course) -> None: # Try and add the given number of sections. sections = [] for name in names: section = course.create_section(name) sections.append(section) sids = [s['id'] for s in sections] snames = [s['name'] for s in sections] assert sorted(snames) == sorted(names) # Clean-up: Delete the sections created above. deleted_ids = [] for sid in sids: del_section = course.delete_section(sid) deleted_ids.append(del_section['id']) assert sorted(deleted_ids) == sorted(sids)