Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Commit d7cb10c

Browse files
committed
Update tests for studydocs
1 parent 857f2cf commit d7cb10c

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

amivapi/tests/studydocs/test_studydocs_auth.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
class StudydocsAuthTest(WebTest):
17-
"""Studycos Test class."""
17+
"""Studydocs Test class."""
1818

1919
def test_uploader_added(self):
2020
"""Test that the uploader is correctly added to a document."""
@@ -25,6 +25,7 @@ def test_uploader_added(self):
2525
headers={'content-type': 'multipart/form-data'},
2626
data={
2727
'title': 'test',
28+
'type': 'cheat sheets',
2829
'files': [
2930
(BytesIO(test_file_content), 'test.zip')
3031
]
@@ -41,6 +42,7 @@ def test_can_edit_own_doc(self):
4142
headers={'content-type': 'multipart/form-data'},
4243
data={
4344
'title': 'test',
45+
'type': 'cheat sheets',
4446
'files': [
4547
(BytesIO(test_file_content), 'test.zip')
4648
]
@@ -65,6 +67,7 @@ def test_can_not_edit_others_docs(self):
6567
headers={'content-type': 'multipart/form-data'},
6668
data={
6769
'title': 'test',
70+
'type': 'cheat sheets',
6871
'files': [
6972
(BytesIO(test_file_content), 'test.zip')
7073
]

amivapi/tests/studydocs/test_summary.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@ def _load_data(self):
1717
self.load_fixture({
1818
'studydocuments': [{
1919
'title': 'first',
20+
'type': 'lecture documents',
2021
'lecture': 'a',
2122
'professor': 'a',
2223
}, {
2324
'title': 'second',
25+
'type': 'cheat sheets',
2426
'lecture': 'a',
2527
'professor': 'b',
2628
}, {
2729
'title': 'third',
30+
'type': 'lecture documents',
2831
'professor': 'b',
2932
}]
3033
})
@@ -38,6 +41,10 @@ def test_full_summary(self):
3841

3942
assert '_summary' in response
4043
assert response['_summary'] == {
44+
'type': {
45+
'lecture documents': 2,
46+
'cheat sheets': 1,
47+
},
4148
'lecture': {
4249
'a': 2,
4350
},
@@ -57,6 +64,10 @@ def test_filtered_summary(self):
5764

5865
assert '_summary' in response
5966
assert response['_summary'] == {
67+
'type': {
68+
'lecture documents': 1, # The document with title `third` is ignored
69+
'cheat sheets': 1,
70+
},
6071
'lecture': {
6172
'a': 2,
6273
},

0 commit comments

Comments
 (0)