Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.
Open
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
4 changes: 2 additions & 2 deletions amivapi/studydocs/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ def _validate_allow_summary(self, *args, **kwargs):
'type': {
'example': 'cheat sheets',
'type': 'string',
'nullable': True,
'default': None,
'required': True,
'nullable': False,
'allowed': ['exams', 'oral exams',
'cheat sheets', 'study guides',
'lecture documents', 'exercises'],
Expand Down
5 changes: 4 additions & 1 deletion amivapi/tests/studydocs/test_studydocs_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


class StudydocsAuthTest(WebTest):
"""Studycos Test class."""
"""Studydocs Test class."""

def test_uploader_added(self):
"""Test that the uploader is correctly added to a document."""
Expand All @@ -25,6 +25,7 @@ def test_uploader_added(self):
headers={'content-type': 'multipart/form-data'},
data={
'title': 'test',
'type': 'cheat sheets',
'files': [
(BytesIO(test_file_content), 'test.zip')
]
Expand All @@ -41,6 +42,7 @@ def test_can_edit_own_doc(self):
headers={'content-type': 'multipart/form-data'},
data={
'title': 'test',
'type': 'cheat sheets',
'files': [
(BytesIO(test_file_content), 'test.zip')
]
Expand All @@ -65,6 +67,7 @@ def test_can_not_edit_others_docs(self):
headers={'content-type': 'multipart/form-data'},
data={
'title': 'test',
'type': 'cheat sheets',
'files': [
(BytesIO(test_file_content), 'test.zip')
]
Expand Down
12 changes: 12 additions & 0 deletions amivapi/tests/studydocs/test_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ def _load_data(self):
self.load_fixture({
'studydocuments': [{
'title': 'first',
'type': 'lecture documents',
'lecture': 'a',
'professor': 'a',
}, {
'title': 'second',
'type': 'cheat sheets',
'lecture': 'a',
'professor': 'b',
}, {
'title': 'third',
'type': 'lecture documents',
'professor': 'b',
}]
})
Expand All @@ -38,6 +41,10 @@ def test_full_summary(self):

assert '_summary' in response
assert response['_summary'] == {
'type': {
'lecture documents': 2,
'cheat sheets': 1,
},
'lecture': {
'a': 2,
},
Expand All @@ -57,6 +64,11 @@ def test_filtered_summary(self):

assert '_summary' in response
assert response['_summary'] == {
'type': {
# The document with title `third` is ignored
'lecture documents': 1,
'cheat sheets': 1,
},
'lecture': {
'a': 2,
},
Expand Down