Skip to content

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leangseu-edx committed Oct 10, 2023
1 parent 41dadaf commit efb57de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions openassessment/xblock/ui_mixins/mfe/assessment_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
"""
# pylint: disable=abstract-method

from rest_framework.fields import (
from rest_framework.serializers import (
CharField,
IntegerField,
SerializerMethodField,
URLField,
Serializer,
)
from openassessment.xblock.ui_mixins.mfe.serializer_utils import NullField


class AssessmentScoreSerializer(Serializer):
Expand Down Expand Up @@ -56,8 +57,6 @@ class AssessmentStepSerializer(Serializer):
stepScore = AssessmentScoreSerializer(source="*")
assessment = AssessmentDataSerializer(source="*")

from openassessment.xblock.ui_mixins.mfe.serializer_utils import NullField


class SubmissionFileSerializer(Serializer):
fileUrl = URLField(source="file_key")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TestAssessmentResponseSerializer(XBlockHandlerTestCase, SubmissionTestMixi
@scenario("data/basic_scenario.xml", user_id="Alan")
def test_no_response(self, xblock):
# Given we are asking for assessment data too early (still on submission step)
context = {"response": None}
context = {"response": None, "step": "submission"}

# When I load my response
data = AssessmentResponseSerializer(xblock.api_data, context=context).data
Expand All @@ -47,7 +47,7 @@ def test_response(self, xblock):
submission = self.create_test_submission(
xblock, submission_text=submission_text
)
context = {"response": submission}
context = {"response": submission, "step": "self"}

# When I load my response
data = AssessmentResponseSerializer(xblock.api_data, context=context).data
Expand All @@ -72,7 +72,7 @@ def test_files_empty(self, xblock):
submission = self.create_test_submission(
xblock, submission_text=submission_text
)
context = {"response": submission}
context = {"response": submission, "step": "self"}

# When I load my response
data = AssessmentResponseSerializer(xblock.api_data, context=context).data
Expand Down Expand Up @@ -138,7 +138,7 @@ def test_files(self, xblock, mock_get_files):
)

# When I load my response
context = {"response": submission}
context = {"response": submission, "step": "self"}
data = AssessmentResponseSerializer(xblock.api_data, context=context).data

# I get the appropriate response (test URLs use usage ID)
Expand Down

0 comments on commit efb57de

Please sign in to comment.