Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-video-pipeline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-video-pipeline
Commits
7d9e88af
Commit
7d9e88af
authored
Sep 12, 2017
by
Qubad786
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve code, fix tests, address feedback
parent
7ee3449d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
22 deletions
+33
-22
VEDA_OS01/models.py
+11
-0
VEDA_OS01/tests/test_transcripts.py
+22
-22
VEDA_OS01/transcripts.py
+0
-0
No files found.
VEDA_OS01/models.py
View file @
7d9e88af
...
@@ -661,6 +661,17 @@ class TranscriptProcessMetadata(TimeStampedModel):
...
@@ -661,6 +661,17 @@ class TranscriptProcessMetadata(TimeStampedModel):
verbose_name_plural
=
'Transcript process metadata'
verbose_name_plural
=
'Transcript process metadata'
get_latest_by
=
'modified'
get_latest_by
=
'modified'
def
update
(
self
,
**
fields
):
"""
Updates a process.
Keyword Arguments:
fields(dict): dict containing all the fields to be updated.
"""
for
attr
,
value
in
fields
.
iteritems
():
setattr
(
self
,
attr
,
value
)
self
.
save
()
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
u'{video} - {provider} - {lang}'
.
format
(
return
u'{video} - {provider} - {lang}'
.
format
(
video
=
self
.
video
.
edx_id
,
video
=
self
.
video
.
edx_id
,
...
...
VEDA_OS01/tests/test_transcripts.py
View file @
7d9e88af
...
@@ -765,21 +765,22 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
...
@@ -765,21 +765,22 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
{
'body'
:
json
.
dumps
({
'iserror'
:
True
}),
'content_type'
:
'application/json'
,
'status'
:
200
},
{
'body'
:
json
.
dumps
({
'iserror'
:
True
}),
'content_type'
:
'application/json'
,
'status'
:
200
},
'error'
,
'error'
,
(
(
'[3PlayMedia Task] Transcript fetch error for video=
%
s -- lang_code=
%
s -- process=
%
s -- response=
%
s'
,
u'[
%
s] Transcript fetch error for video=
%
s -- lang_code=
%
s -- process=
%
s -- response=
%
s'
,
ANY
,
u'3PlayMedia Callback'
,
ANY
,
u'12345'
,
ANY
,
u'en'
,
ANY
u'112233'
,
json
.
dumps
({
'iserror'
:
True
}),
),
),
),
),
(
(
{
'body'
:
None
,
'status'
:
400
},
{
'body'
:
None
,
'status'
:
400
},
'exception'
,
'exception'
,
(
(
'[3PlayMedia Callback] Fetch request failed for video=
%
s -- lang
=
%
s -- process_id=
%
s'
,
u'[3PlayMedia Callback] Fetch request failed for video=
%
s -- lang_code
=
%
s -- process_id=
%
s'
,
ANY
,
u'12345'
,
ANY
,
u'en'
,
ANY
,
u'112233'
,
),
),
)
)
)
)
...
@@ -870,10 +871,9 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
...
@@ -870,10 +871,9 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
{
{
'method'
:
'exception'
,
'method'
:
'exception'
,
'args'
:
(
'args'
:
(
'[3PlayMedia Callback] Translation could not be performed - org=
%
s, edx_video_id=
%
s, '
'[3PlayMedia Callback] Translation could not be performed - video=
%
s, lang_code=
%
s, file_id=
%
s.'
,
'file_id=
%
s.'
,
'MAx'
,
'12345'
,
'12345'
,
'en'
,
'112233'
'112233'
)
)
}
}
...
@@ -893,10 +893,9 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
...
@@ -893,10 +893,9 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
{
{
'method'
:
'exception'
,
'method'
:
'exception'
,
'args'
:
(
'args'
:
(
'[3PlayMedia Callback] Translation could not be performed - org=
%
s, edx_video_id=
%
s, '
'[3PlayMedia Callback] Translation could not be performed - video=
%
s, lang_code=
%
s, file_id=
%
s.'
,
'file_id=
%
s.'
,
'MAx'
,
'12345'
,
'12345'
,
'en'
,
'112233'
'112233'
)
)
}
}
...
@@ -1203,7 +1202,6 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
...
@@ -1203,7 +1202,6 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
decode_func
=
json
.
loads
,
decode_func
=
json
.
loads
,
)
)
@data
(
@data
(
# not-an-ok response on translation status fetch request.
# not-an-ok response on translation status fetch request.
(
(
...
@@ -1228,7 +1226,7 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
...
@@ -1228,7 +1226,7 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
400
,
400
,
)
)
},
},
TranscriptStatus
.
IN_PROGRESS
TranscriptStatus
.
FAILED
),
),
# 3Play Error response on fetching translations status.
# 3Play Error response on fetching translations status.
(
(
...
@@ -1245,7 +1243,8 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
...
@@ -1245,7 +1243,8 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
{
{
'method'
:
'error'
,
'method'
:
'error'
,
'args'
:
(
'args'
:
(
'[3PlayMedia Task] Translation error for video=
%
s -- lang_code=
%
s -- process_id=
%
s -- response=
%
s'
,
'[3PlayMedia Task] unable to get translation status for '
'video=
%
s -- lang_code=
%
s -- process_id=
%
s -- response=
%
s'
,
VIDEO_DATA
[
'studio_id'
],
VIDEO_DATA
[
'studio_id'
],
'ro'
,
'ro'
,
'112233'
,
'112233'
,
...
@@ -1268,7 +1267,7 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
...
@@ -1268,7 +1267,7 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
'status'
:
200
,
'status'
:
200
,
},
},
{
{
'm
o
thod'
:
responses
.
GET
,
'm
e
thod'
:
responses
.
GET
,
'url'
:
transcripts
.
THREE_PLAY_TRANSLATION_DOWNLOAD_URL
.
format
(
'url'
:
transcripts
.
THREE_PLAY_TRANSLATION_DOWNLOAD_URL
.
format
(
file_id
=
'112233'
,
translation_id
=
'1q2w3e'
file_id
=
'112233'
,
translation_id
=
'1q2w3e'
),
),
...
@@ -1302,7 +1301,7 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
...
@@ -1302,7 +1301,7 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
'status'
:
200
,
'status'
:
200
,
},
},
{
{
'm
o
thod'
:
responses
.
GET
,
'm
e
thod'
:
responses
.
GET
,
'url'
:
transcripts
.
THREE_PLAY_TRANSLATION_DOWNLOAD_URL
.
format
(
'url'
:
transcripts
.
THREE_PLAY_TRANSLATION_DOWNLOAD_URL
.
format
(
file_id
=
'112233'
,
translation_id
=
'1q2w3e'
file_id
=
'112233'
,
translation_id
=
'1q2w3e'
),
),
...
@@ -1314,7 +1313,8 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
...
@@ -1314,7 +1313,8 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
{
{
'method'
:
'error'
,
'method'
:
'error'
,
'args'
:
(
'args'
:
(
'[3PlayMedia Task] Translation error for video=
%
s -- lang_code=
%
s -- process_id=
%
s -- response=
%
s'
,
'[
%
s] Transcript fetch error for video=
%
s -- lang_code=
%
s -- process=
%
s -- response=
%
s'
,
'3PlayMedia Task'
,
VIDEO_DATA
[
'studio_id'
],
VIDEO_DATA
[
'studio_id'
],
'ro'
,
'ro'
,
'112233'
,
'112233'
,
...
@@ -1328,7 +1328,7 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
...
@@ -1328,7 +1328,7 @@ class ThreePlayTranscriptionCallbackTest(APITestCase):
@responses.activate
@responses.activate
@mock_s3_deprecated
@mock_s3_deprecated
@patch
(
'VEDA_OS01.transcripts.LOGGER'
)
@patch
(
'VEDA_OS01.transcripts.LOGGER'
)
def
translations_retrieval_exceptions
(
self
,
mock_responses
,
expected_logging
,
transcript_status
,
mock_logger
):
def
t
est_t
ranslations_retrieval_exceptions
(
self
,
mock_responses
,
expected_logging
,
transcript_status
,
mock_logger
):
"""
"""
Tests possible error cases during translation fetch process form 3PlayMedia.
Tests possible error cases during translation fetch process form 3PlayMedia.
"""
"""
...
...
VEDA_OS01/transcripts.py
View file @
7d9e88af
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment