Exemple #1
0
def test_create_group_category(name: str, course: Course) -> None:

    # Try and add the given group category.
    gcat = course.create_group_category(name)
    assert is_valid_group_category(gcat)
    assert gcat['name'] == name

    # Try and delete the group category created above.
    deleted_gcat = course.delete_group_category(gcat['id'])
    assert is_valid_group_category(deleted_gcat)
    assert deleted_gcat['id'] == gcat['id']
Exemple #2
0
def test_create_group_categories(names: List[str], course: Course) -> None:

    # Try and add the given number of group categories.
    gcats = []
    for name in names:
        gcat = course.create_group_category(name)
        gcats.append(gcat)

    gcat_ids = [gcat['id'] for gcat in gcats]
    gcat_names = [gcat['name'] for gcat in gcats]

    assert sorted(gcat_names) == sorted(names)

    # Clean-up: Delete the group categories added above.
    del_gcat_ids = []
    for gcat_id in gcat_ids:
        del_gcat = course.delete_group_category(gcat_id)
        del_gcat_ids.append(del_gcat['id'])
    assert sorted(del_gcat_ids) == sorted(gcat_ids)