Skip to content
Snippets Groups Projects
Commit 997b3474 authored by Christopher Bohn's avatar Christopher Bohn :thinking:
Browse files

added script to produce a list of teams for whitebox testing

parent f7937212
Branches
No related tags found
No related merge requests found
from canvasapi import Canvas
from config import Config
from course import Course
def get_groups():
canvas = Canvas(Config.canvas_url, Config.canvas_api_key)
course = canvas.get_course(Course.canvas_course_id)
group_categories = course.get_group_categories()[0] # right now, there should just be the one
return group_categories.get_groups()
def print_teams(groups):
print('Teams for Pair Assignment 05 (whitebox testing)')
print()
for group in groups:
users = group.get_users(include=['email'])
print(f'{group.name}:\t{users[0].name} <{users[0].email}>, {users[1].name} <{users[1].email}>')
# we can pull this off because there are 2n students
def write_teams(groups, filename):
file = open(filename, 'x')
file.write('Teams for Pair Assignment 05 (whitebox testing)\n')
file.write('\n')
for group in groups:
users = group.get_users(include=['email'])
file.write(f'{group.name}:\t{users[0].name} <{users[0].email}>, {users[1].name} <{users[1].email}>\n')
file.close()
if __name__ == '__main__':
# print_teams(get_groups())
write_teams(get_groups(), '05teams.txt')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment