Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ MAKE := $(MAKE) --no-print-directory
SHELL = bash

ci:
pipenv run pytest --cov=codepost_api
pipenv run pytest --cov=codePost_api

init:
pip install --upgrade pip~=18.0 pipenv==2018.10.13
Expand Down
4 changes: 2 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tox = "*"
nose = "*"
requests = "*"
urllib3 = "*"
codepost_api = {path = ".",editable = true}
codePost_api = {path = ".",editable = true}

[requires]
python_version = "3.7"
python_version = "3.7"
1 change: 1 addition & 0 deletions codePost_api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from codePost_api.helpers import *
File renamed without changes.
1 change: 0 additions & 1 deletion codepost_api/__init__.py

This file was deleted.

52 changes: 26 additions & 26 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# Third-party imports...
from nose.tools import assert_equal, assert_is_not_none

# codepost_api imports...
import codepost_api as helpers
# codePost_api imports...
import codePost_api as helpers

# test constants
TEST_API_KEY = 'TEST_KEY'
Expand All @@ -25,7 +25,7 @@
class TestGetAvailableCourses(object):
@classmethod
def setup_class(cls):
cls.mock_get_patcher = patch('codepost_api.helpers._requests.get')
cls.mock_get_patcher = patch('codePost_api.helpers._requests.get')
cls.mock_get = cls.mock_get_patcher.start()

@classmethod
Expand Down Expand Up @@ -95,7 +95,7 @@ def test_get_available_courses_on_success_with_no_filter_results(self):
# Notes:
#
#############################################################################
@patch('codepost_api.helpers._requests.get')
@patch('codePost_api.helpers._requests.get')
def test_get_course_roster_by_id(mock_get):
roster = {'id': 1}

Expand All @@ -110,8 +110,8 @@ def test_get_course_roster_by_id(mock_get):
# Notes:
#
#############################################################################
@patch('codepost_api.helpers.get_course_roster_by_id')
@patch('codepost_api.helpers.get_available_courses')
@patch('codePost_api.helpers.get_course_roster_by_id')
@patch('codePost_api.helpers.get_available_courses')
def test_get_course_roster_by_name(mock_get_available_courses, mock_get_course_roster_by_id):
course1 = {'id' : 1, 'name' : 'COS126', 'period' : 'S2019'}
roster = {'id': 1, 'students': ['someEmail@princeton.edu']}
Expand All @@ -130,7 +130,7 @@ def test_get_course_roster_by_name(mock_get_available_courses, mock_get_course_r
# Notes:
#
#############################################################################
@patch('codepost_api.helpers._requests.get')
@patch('codePost_api.helpers._requests.get')
def test_get_assignment_info_by_id(mock_get):
assignment = {'id': 1}

Expand All @@ -145,8 +145,8 @@ def test_get_assignment_info_by_id(mock_get):
# Notes:
#
#############################################################################
@patch('codepost_api.helpers.get_assignment_info_by_id')
@patch('codepost_api.helpers.get_available_courses')
@patch('codePost_api.helpers.get_assignment_info_by_id')
@patch('codePost_api.helpers.get_available_courses')
def test_get_assignment_info_by_name(mock_get_available_courses, mock_get_assignment_info_by_id):

# mock get_available_courses
Expand All @@ -170,7 +170,7 @@ def side_effect(api_key, assignment_id):
# Notes:
#
#############################################################################
@patch('codepost_api.helpers._requests.get')
@patch('codePost_api.helpers._requests.get')
def test_get_assignment_submissions(mock_get):
# Configure the mock to return a response with an OK status code.
submission1 = {
Expand All @@ -196,7 +196,7 @@ def test_get_assignment_submissions(mock_get):
# Notes:
#
#############################################################################
@patch('codepost_api.helpers._requests.get')
@patch('codePost_api.helpers._requests.get')
def test_get_file(mock_get):
# Configure the mock to return a response with an OK status code.
file = {
Expand All @@ -220,7 +220,7 @@ def test_get_file(mock_get):
# - should we return the uploaded submission here instead of a boolean
#
#############################################################################
@patch('codepost_api.helpers._requests.patch')
@patch('codePost_api.helpers._requests.patch')
def test_set_submission_grader(mock_patch):
submission1 = {
'id' : 1,
Expand All @@ -239,7 +239,7 @@ def test_set_submission_grader(mock_patch):
# Notes:
#
#############################################################################
@patch('codepost_api.helpers._requests.patch')
@patch('codePost_api.helpers._requests.patch')
def test_unclaim_submission(mock_patch):
submission1 = {
'id' : 1,
Expand All @@ -258,8 +258,8 @@ def test_unclaim_submission(mock_patch):
# Notes:
#
#############################################################################
@patch('codepost_api.helpers._requests.delete')
@patch('codepost_api.helpers._requests.get')
@patch('codePost_api.helpers._requests.delete')
@patch('codePost_api.helpers._requests.get')
def test_remove_comments(mock_get, mock_delete):
file1 = {
'id' : 1,
Expand All @@ -280,7 +280,7 @@ def test_remove_comments(mock_get, mock_delete):
# Notes:
#
#############################################################################
@patch('codepost_api.helpers._requests.delete')
@patch('codePost_api.helpers._requests.delete')
def test_delete_submission(mock_delete):
mock_delete.return_value.status_code = 204
response = helpers.delete_submission(TEST_API_KEY, 1)
Expand All @@ -291,7 +291,7 @@ def test_delete_submission(mock_delete):
# Notes:
#
#############################################################################
@patch('codepost_api.helpers._requests.delete')
@patch('codePost_api.helpers._requests.delete')
def test_delete_file(mock_delete):
mock_delete.return_value.status_code = 204
response = helpers.delete_file(TEST_API_KEY, 1)
Expand All @@ -302,7 +302,7 @@ def test_delete_file(mock_delete):
# Notes:
#
#############################################################################
@patch('codepost_api.helpers._requests.post')
@patch('codePost_api.helpers._requests.post')
def test_post_file(mock_post):
mock_post.return_value.status_code = 201
response = helpers.post_file(TEST_API_KEY, 1, 'test.txt', 'hello', 'txt')
Expand All @@ -313,7 +313,7 @@ def test_post_file(mock_post):
# Notes:
#
#############################################################################
@patch('codepost_api.helpers._requests.post')
@patch('codePost_api.helpers._requests.post')
def test_post_submission(mock_post):
file = {'name' : 'test.txt', 'code' : 'hello', 'extension' : 'txt'}
mock_post.return_value.status_code = 201
Expand All @@ -325,7 +325,7 @@ def test_post_submission(mock_post):
# Notes:
#
#############################################################################
@patch('codepost_api.helpers._requests.post')
@patch('codePost_api.helpers._requests.post')
def test_post_comment(mock_post):
file = {'name' : 'test.txt', 'code' : 'hello', 'extension' : 'txt', 'id' : 1}
mock_post.return_value.status_code = 201
Expand All @@ -337,7 +337,7 @@ def test_post_comment(mock_post):
# Notes:
#
#############################################################################
@patch('codepost_api.helpers._requests.patch')
@patch('codePost_api.helpers._requests.patch')
def test_set_submission_students(mock_patch):
mock_patch.return_value.status_code = 200
response = helpers.set_submission_students(TEST_API_KEY, 1, ['student1@codepost.io'])
Expand All @@ -348,8 +348,8 @@ def test_set_submission_students(mock_patch):
# Notes:
#
#############################################################################
@patch('codepost_api.helpers._requests.delete')
@patch('codepost_api.helpers._requests.patch')
@patch('codePost_api.helpers._requests.delete')
@patch('codePost_api.helpers._requests.patch')
def test_remove_students_from_submission(mock_patch, mock_delete):
submission1 = {
'id' : 1,
Expand Down Expand Up @@ -381,9 +381,9 @@ def test_remove_students_from_submission(mock_patch, mock_delete):
# Notes:
#
#############################################################################
@patch('codepost_api.helpers.get_assignment_submissions')
@patch('codepost_api.helpers.get_assignment_info_by_id')
@patch('codepost_api.helpers.get_course_roster_by_name')
@patch('codePost_api.helpers.get_assignment_submissions')
@patch('codePost_api.helpers.get_assignment_info_by_id')
@patch('codePost_api.helpers.get_course_roster_by_name')
def test_get_course_grades(mock_roster, mock_assignment, mock_submissions):
roster = {
'name' : 'COS126',
Expand Down
10 changes: 5 additions & 5 deletions tests/test_submission_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
# Third-party imports...
from nose.tools import assert_equal, assert_is_not_none

# codepost_api imports...
import codepost_api as helpers
# codePost_api imports...
import codePost_api as helpers

# test constants
TEST_API_KEY = 'TEST_KEY'

@patch('codepost_api.helpers.post_submission')
@patch('codepost_api.helpers.get_assignment_submissions')
@patch('codePost_api.helpers.post_submission')
@patch('codePost_api.helpers.get_assignment_submissions')
def test_upload_submission_with_no_conflicts(mock_get_submissions, mock_post_submission):

# create mock data
Expand Down Expand Up @@ -48,4 +48,4 @@ def side_effect(api_key, assignment_id, students, files):
'students' : ['student1@codepost.io'],
'files' : [file1]
}
assert_equal(answer, response)
assert_equal(answer, response)