Skip to content

Commit

Permalink
Intern task (#3)
Browse files Browse the repository at this point in the history
* WIP

* WIP
  • Loading branch information
sumanth-fyle authored May 17, 2022
1 parent 368654a commit 89da416
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Described [here](./Application.md)
### Your tasks
1. Add missing APIs mentioned [here](./Application.md#Missing-APIs) and get the automated tests to pass
2. Add a test for grading API
3. Get the test coverage to 94% or above

This comment has been minimized.

Copy link
@Shiva-Ram-Reddy-Marthala

Shiva-Ram-Reddy-Marthala May 28, 2022

complete the task

This comment has been minimized.

Copy link
@AnkitMourya12

AnkitMourya12 Apr 7, 2023

  1. GET /assignments/{id}
    PUT /assignments/{id}
    POST /teacher/assignments/{id}/grade
  2. coverage run -m pytest
     coverage report -m
    

This comment has been minimized.

Copy link
@AnkitMourya12

AnkitMourya12 Apr 7, 2023

2=3

3. All tests should pass
4. Get the test coverage to 94% or above

## Submission

Expand Down
2 changes: 0 additions & 2 deletions core/models/assignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ def submit(cls, _id, teacher_id, principal: Principal):
assignment = Assignment.get_by_id(_id)
assertions.assert_found(assignment, 'No assignment with this id was found')
assertions.assert_valid(assignment.student_id == principal.student_id, 'This assignment belongs to some other student')
assertions.assert_valid(assignment.state == AssignmentStateEnum.DRAFT,
'only a draft assignment can be submitted')
assertions.assert_valid(assignment.content is not None, 'assignment with empty content cannot be submitted')

assignment.teacher_id = teacher_id
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ marshmallow-enum==1.5.1
marshmallow-sqlalchemy==0.26.1
packaging==21.0
pluggy==1.0.0
psycopg2-binary==2.8.6

This comment has been minimized.

Copy link
@Shiva-Ram-Reddy-Marthala

Shiva-Ram-Reddy-Marthala May 28, 2022

psycopg-binary==2.8.6

py==1.10.0
pyparsing==2.4.7
pytest==6.2.5
Expand All @@ -30,4 +29,4 @@ toml==0.10.2
Werkzeug==2.0.1
zipp==3.5.0
zope.event==4.5.0
zope.interface==5.4.0

This comment has been minimized.

Copy link
@Shiva-Ram-Reddy-Marthala

Shiva-Ram-Reddy-Marthala May 28, 2022

zope.interface==5.3.9

This comment has been minimized.

Copy link
@Shiva-Ram-Reddy-Marthala

Shiva-Ram-Reddy-Marthala May 28, 2022

zope.interface==4.5.0

zope.interface==5.4.0
14 changes: 14 additions & 0 deletions tests/students_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,17 @@ def test_submit_assignment_student_1(client, h_student_1):
assert data['student_id'] == 1
assert data['state'] == 'SUBMITTED'
assert data['teacher_id'] == 2


def test_assingment_resubmitt_error(client, h_student_1):
response = client.post(
'/student/assignments/submit',
headers=h_student_1,
json={
'id': 2,
'teacher_id': 2
})
error_response = response.json
assert response.status_code == 400
assert error_response['error'] == 'FyleError'
assert error_response["message"] == 'only a draft assignment can be submitted'

0 comments on commit 89da416

Please sign in to comment.