eecs485staff / agio-cli

A command line interface to autograder.io
MIT License
1 stars 0 forks source link

Access value inside pick.Option #41

Closed japplefield closed 2 years ago

japplefield commented 2 years ago

40 introduced a bug:

(env) jmapple@Justins-MacBook-Pro agio-cli % ./env/bin/agio groups  
# After picker for the course
Traceback (most recent call last):
  File "/Users/jmapple/Developer/eecs485-staff/agio-cli/./env/bin/agio", line 33, in <module>
    sys.exit(load_entry_point('agiocli', 'console_scripts', 'agio')())
  File "/Users/jmapple/Developer/eecs485-staff/agio-cli/env/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/jmapple/Developer/eecs485-staff/agio-cli/env/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/jmapple/Developer/eecs485-staff/agio-cli/env/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/jmapple/Developer/eecs485-staff/agio-cli/env/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/jmapple/Developer/eecs485-staff/agio-cli/env/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/jmapple/Developer/eecs485-staff/agio-cli/env/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/jmapple/Developer/eecs485-staff/agio-cli/agiocli/__main__.py", line 185, in groups
    group = utils.get_group_smart(group_arg, project_arg, course_arg, client)
  File "/Users/jmapple/Developer/eecs485-staff/agio-cli/agiocli/utils.py", line 458, in get_group_smart
    project = get_project_smart(project_arg, course_arg, client)
  File "/Users/jmapple/Developer/eecs485-staff/agio-cli/agiocli/utils.py", line 378, in get_project_smart
    projects = get_course_project_list(course, client)
  File "/Users/jmapple/Developer/eecs485-staff/agio-cli/agiocli/utils.py", line 357, in get_course_project_list
    projects = client.get(f"/api/courses/{course['pk']}/projects/")
TypeError: 'Option' object is not subscriptable

This is because we're returning selected_courses[0] which is now the Option and not a dict.

japplefield commented 2 years ago

Tests didn't catch this because we're mocking calls to pick.pick to return Tuple(dict, int) when they're actually returning Tuple(pick.Option, int) I think?