-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FC-73 create pr for edx platform repository (Creating waffle flag for integration towards created_submission in the edx-submission repo) #36235
Closed
gabrielC1409
wants to merge
11
commits into
openedx:master
from
aulasneo:XQU-27-create-pr-for-edx-platform-repository
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
cd0562c
test evaluations
gabriel1407 d63843d
Ticket complete
gabrielC1409 3b516a3
Refactoring xqueueInterface and xqueueServices
gabrielC1409 51dd121
Connect xqueue_interfaces to xqueue_submission
gabrielC1409 6ba5b64
XQU-16 Waffle_flag and recompatibility completed
gabrielC1409 8e5ba4a
Config waffle flag
gabrielC1409 a21411b
Send grader to created_submission complete
gabrielC1409 00a9219
Changes to be shown in the edx-platform PR
gabrielC1409 5543105
fix: Setting XQUEUE INTERFACE environment variable user and password …
gabrielC1409 6184417
Merge branch 'master' into XQU-27-create-pr-for-edx-platform-repository
gabriel1407 9a5a79c
Merge branch 'openedx:master' into XQU-27-create-pr-for-edx-platform-…
gabrielC1409 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1094,8 +1094,8 @@ | |
'url': 'http://localhost:18040', | ||
'basic_auth': ['edx', 'edx'], | ||
'django_auth': { | ||
'username': 'lms', | ||
'password': 'password' | ||
'username': 'gabriel_admin', | ||
'password': 'carvajal1407' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this changing? |
||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import json | ||
import pytest | ||
from unittest.mock import Mock, patch | ||
from django.conf import settings | ||
from xmodule.capa.xqueue_submission import XQueueInterfaceSubmission | ||
from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator | ||
from xblock.fields import ScopeIds | ||
|
||
|
||
@pytest.fixture | ||
def xqueue_service(): | ||
location = BlockUsageLocator(CourseLocator("test_org", "test_course", "test_run"), "problem", "ExampleProblem") | ||
block = Mock(scope_ids=ScopeIds('user1', 'mock_problem', location, location)) | ||
return XQueueInterfaceSubmission() | ||
|
||
|
||
def test_extract_item_data(): | ||
header = json.dumps({ | ||
'lms_callback_url': 'http://example.com/courses/course-v1:org+course+run/xqueue/5/block-v1:org+course+run+type@problem+block@item_id/score_update', | ||
}) | ||
payload = json.dumps({ | ||
'student_info': json.dumps({'anonymous_student_id': 'student_id'}), | ||
'student_response': 'student_answer', | ||
'grader_payload': json.dumps({'grader': 'test.py'}) | ||
}) | ||
with patch('lms.djangoapps.courseware.models.StudentModule.objects.filter') as mock_filter: | ||
mock_filter.return_value.first.return_value = Mock(grade=0.85) | ||
|
||
student_item, student_answer, queue_name,grader, score = XQueueInterfaceSubmission().extract_item_data(header, payload) | ||
|
||
assert student_item == { | ||
'item_id': 'block-v1:org+course+run+type@problem+block@item_id', | ||
'item_type': 'problem', | ||
'course_id': 'course-v1:org+course+run', | ||
'student_id': 'student_id' | ||
} | ||
assert student_answer == 'student_answer' | ||
assert queue_name == 'default' | ||
assert grader == 'test.py' | ||
assert score == 0.85 | ||
|
||
|
||
@patch('submissions.api.create_submission') | ||
def test_send_to_submission(mock_create_submission, xqueue_service): | ||
header = json.dumps({ | ||
'lms_callback_url': 'http://example.com/courses/course-v1:test_org+test_course+test_run/xqueue/5/block-v1:test_org+test_course+test_run+type@problem+block@item_id/score_update', | ||
}) | ||
body = json.dumps({ | ||
'student_info': json.dumps({'anonymous_student_id': 'student_id'}), | ||
'student_response': 'student_answer', | ||
'grader_payload': json.dumps({'grader': 'test.py'}) | ||
}) | ||
|
||
with patch('lms.djangoapps.courseware.models.StudentModule.objects.filter') as mock_filter: | ||
mock_filter.return_value.first.return_value = Mock(grade=0.85) | ||
|
||
mock_create_submission.return_value = {'submission': 'mock_submission'} | ||
|
||
# Llamada a send_to_submission | ||
result = xqueue_service.send_to_submission(header, body) | ||
|
||
# Afirmaciones | ||
assert 'submission' in result | ||
assert result['submission'] == 'mock_submission' | ||
mock_create_submission.assert_called_once_with( | ||
{ | ||
'item_id': 'block-v1:test_org+test_course+test_run+type@problem+block@item_id', | ||
'item_type': 'problem', | ||
'course_id': 'course-v1:test_org+test_course+test_run', | ||
'student_id': 'student_id' | ||
}, | ||
'student_answer', | ||
queue_name='default', | ||
grader='test.py', | ||
score=0.85 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this changing?