Repository: ucfopen/canvasapi

Issue:
quiz.get_quiz_submission() strips included data
# Describe the bug

quiz.get_quiz_submission() only keeps ["quiz_submissions"][0] from the returned data. If you use the kwarg `include` you can have the request include submission, quiz, or user, but this data is omitted by the function.

# To Reproduce

1. Turn on logging as described in the docs
2. Get a quiz
3. Call `quiz.get_get_quiz_submission(submission_id, include=['quiz'])`
4. The log will show the returned data including more than what is included in the resulting object

# Expected behavior

The raw data returned from the API looks like this:
```
{
  'quiz_submissions': [{...}],
  'quizzes': [{...}]
}
```

# Environment information

- Python version - 3.7.6
- CanvasAPI version - 0.15.0


Discussion:
coveralls: 
[![Coverage Status](https://coveralls.io/builds/28953722/badge)](https://coveralls.io/builds/28953722)

Coverage remained the same at 100.0% when pulling **af9c78fe3a33482d5a6d5ff5eb5009316d7b6397 on Mike-Nahmias:issue/347-quiz-submission-data** into **309210681e28c58256ce5999a513b8a70f8aba31 on ucfopen:develop**.


Patch:
diff --git a/canvasapi/quiz.py b/canvasapi/quiz.py
index 0cce770..efd945b 100644
--- a/canvasapi/quiz.py
+++ b/canvasapi/quiz.py
@@ -8,6 +8,8 @@ from canvasapi.canvas_object import CanvasObject
 from canvasapi.exceptions import RequiredFieldMissing
 from canvasapi.paginated_list import PaginatedList
 from canvasapi.quiz_group import QuizGroup
+from canvasapi.submission import Submission
+from canvasapi.user import User
 from canvasapi.util import combine_kwargs, obj_or_id
 
 
@@ -374,6 +376,22 @@ class Quiz(CanvasObject):
 
         response_json = response.json()["quiz_submissions"][0]
         response_json.update({"course_id": self.course_id})
+        if len(response.json().get("quizzes", [])) > 0:
+            response_json.update(
+                {"quiz": Quiz(self._requester, response.json()["quizzes"][0])}
+            )
+        if len(response.json().get("submissions", [])) > 0:
+            response_json.update(
+                {
+                    "submission": Submission(
+                        self._requester, response.json()["submissions"][0]
+                    )
+                }
+            )
+        if len(response.json().get("users", [])) > 0:
+            response_json.update(
+                {"user": User(self._requester, response.json()["users"][0])}
+            )
 
         return QuizSubmission(self._requester, response_json)
 


Test patch:
diff --git a/tests/fixtures/quiz.json b/tests/fixtures/quiz.json
index 1a0c09e..253e05c 100644
--- a/tests/fixtures/quiz.json
+++ b/tests/fixtures/quiz.json
@@ -219,6 +219,30 @@
 					"validation_token": "this is a validation token",
 					"score": 0
 				}
+			],
+			"quizzes": [
+				{
+					"id": 1,
+					"title": "Test Quiz",
+					"quiz_type": "survey"
+				}
+			],
+			"submissions": [
+				{
+					"id": 1,
+					"body": "user: 1, quiz: 1, score: 1.0, time: 2020-01-01 00:00:00Z",
+					"grade": "1",
+					"score": 1,
+					"assignment_id": 1234,
+					"user_id": 1
+				}
+			],
+			"users": [
+				{
+					"id": 1,
+					"name": "Test User",
+					"login_id": "testuser@example.com"
+				}
 			]
 		},
 		"status_code": 200
diff --git a/tests/test_quiz.py b/tests/test_quiz.py
index 4e87972..cf0b010 100644
--- a/tests/test_quiz.py
+++ b/tests/test_quiz.py
@@ -22,6 +22,8 @@ from canvasapi.quiz_group import QuizGroup
 from canvasapi.paginated_list import PaginatedList
 from tests import settings
 from tests.util import register_uris
+from canvasapi.user import User
+from canvasapi.submission import Submission
 
 
 @requests_mock.Mocker()
@@ -319,19 +321,24 @@ class TestQuiz(unittest.TestCase):
         register_uris({"quiz": ["get_quiz_submission"]}, m)
 
         quiz_id = 1
-        submission = self.quiz.get_quiz_submission(quiz_id)
+        quiz_submission = self.quiz.get_quiz_submission(
+            quiz_id, include=["quiz", "submission", "user"]
+        )
 
-        self.assertIsInstance(submission, QuizSubmission)
-        self.assertTrue(hasattr(submission, "id"))
-        self.assertEqual(submission.quiz_id, quiz_id)
-        self.assertTrue(hasattr(submission, "quiz_version"))
-        self.assertEqual(submission.quiz_version, 1)
-        self.assertTrue(hasattr(submission, "user_id"))
-        self.assertEqual(submission.user_id, 1)
-        self.assertTrue(hasattr(submission, "validation_token"))
-        self.assertEqual(submission.validation_token, "this is a validation token")
-        self.assertTrue(hasattr(submission, "score"))
-        self.assertEqual(submission.score, 0)
+        self.assertIsInstance(quiz_submission, QuizSubmission)
+        self.assertTrue(hasattr(quiz_submission, "id"))
+        self.assertEqual(quiz_submission.quiz_id, quiz_id)
+        self.assertTrue(hasattr(quiz_submission, "quiz_version"))
+        self.assertEqual(quiz_submission.quiz_version, 1)
+        self.assertTrue(hasattr(quiz_submission, "user_id"))
+        self.assertEqual(quiz_submission.user_id, 1)
+        self.assertTrue(hasattr(quiz_submission, "validation_token"))
+        self.assertEqual(quiz_submission.validation_token, "this is a validation token")
+        self.assertTrue(hasattr(quiz_submission, "score"))
+        self.assertEqual(quiz_submission.score, 0)
+        self.assertIsInstance(quiz_submission.quiz, Quiz)
+        self.assertIsInstance(quiz_submission.submission, Submission)
+        self.assertIsInstance(quiz_submission.user, User)
 
     # create_submission
     def test_create_submission(self, m):