Skip to content

Commit

Permalink
Updated to an API change.
Browse files Browse the repository at this point in the history
  • Loading branch information
eriq-augustine committed Dec 11, 2023
1 parent e6135b1 commit 5134cb5
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .ci/verify_test_api_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
sys.path.append(ROOT_DIR)

import autograder.api.config
import autograder.api.admin.coursereload
import autograder.api.admin.updatecourse
import tests.api.test_api

def verify_test_case(cli_arguments, path):
Expand Down Expand Up @@ -56,7 +56,7 @@ def reset_course(cli_arguments):

arguments['clear'] = True

autograder.api.admin.coursereload.send(arguments)
autograder.api.admin.updatecourse.send(arguments)

def run(arguments):
error_count = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import autograder.api.common
import autograder.api.config

API_ENDPOINT = 'admin/course/reload'
API_ENDPOINT = 'admin/update/course'
API_PARAMS = [
autograder.api.config.PARAM_COURSE_ID,
autograder.api.config.PARAM_USER_EMAIL,
autograder.api.config.PARAM_USER_PASS,

autograder.api.config.APIParam('clear',
'Clear the course database before reloading.',
'Clear the course database before updating.',
required = False,
parser_options = {'action': 'store_true', 'default': False})
]

DESCRIPTION = 'Reload a course from its config.'
DESCRIPTION = 'Update a course from its source.'

def send(arguments, **kwargs):
return autograder.api.common.handle_api_request(arguments, API_PARAMS, API_ENDPOINT, **kwargs)
Expand Down
17 changes: 0 additions & 17 deletions autograder/cli/admin/course-reload.py

This file was deleted.

22 changes: 22 additions & 0 deletions autograder/cli/admin/update-course.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import sys

import autograder.api.admin.updatecourse

def run(arguments):
result = autograder.api.admin.updatecourse.send(arguments, exit_on_error = True)

if (result['course-updated']):
print("Course updated.")
else:
print("Course not updated. The request was successful, does the course have a source?")

return 0

def main():
return run(_get_parser().parse_args())

def _get_parser():
return autograder.api.admin.updatecourse._get_parser()

if (__name__ == '__main__'):
sys.exit(main())
5 changes: 0 additions & 5 deletions tests/api/data/test_admin_course_reload_base.json

This file was deleted.

7 changes: 7 additions & 0 deletions tests/api/data/test_admin_update_course_base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"endpoint": "admin/update/course",
"arguments": {},
"output": {
"course-updated": true
}
}
9 changes: 9 additions & 0 deletions tests/api/data/test_admin_update_course_clear.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"endpoint": "admin/update/course",
"arguments": {
"clear": true
},
"output": {
"course-updated": true
}
}
9 changes: 9 additions & 0 deletions tests/api/data/test_admin_update_course_no_update.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"endpoint": "admin/update/course",
"arguments": {
"course": "course-without-source"
},
"output": {
"course-updated": false
}
}

0 comments on commit 5134cb5

Please sign in to comment.