Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Merge requests
!1525
Support text orientation in (partial) update transcription
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Support text orientation in (partial) update transcription
update-text-orientation
into
master
Overview
0
Commits
20
Pipelines
0
Changes
1
Merged
ml bonhomme
requested to merge
update-text-orientation
into
master
3 years ago
Overview
0
Commits
20
Pipelines
0
Changes
1
Expand
closes
#851 (closed)
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
51e935a9
20 commits,
3 years ago
1 file
+
82
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
arkindex/documents/tests/test_edit_transcriptions.py
+
82
−
0
Options
@@ -149,6 +149,88 @@ class TestEditTranscription(FixtureAPITestCase):
'
worker_version_id
'
:
None
,
})
def
test_transcription_patch_orientation
(
self
):
"""
Assert it is possible to edit only the text orientation
"""
self
.
client
.
force_login
(
self
.
user
)
manual_tr_id
=
self
.
manual_transcription
.
id
response
=
self
.
client
.
patch
(
reverse
(
'
api:transcription-edit
'
,
kwargs
=
{
'
pk
'
:
manual_tr_id
}),
format
=
'
json
'
,
data
=
{
'
orientation
'
:
'
vertical-rl
'
}
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
self
.
manual_transcription
.
refresh_from_db
()
self
.
assertDictEqual
(
response
.
json
(),
{
'
id
'
:
str
(
manual_tr_id
),
'
confidence
'
:
None
,
'
score
'
:
None
,
'
text
'
:
'
A manual transcription
'
,
'
orientation
'
:
'
vertical-rl
'
,
'
worker_version_id
'
:
None
,
})
def
test_transcription_patch_invalid_orientation
(
self
):
"""
An invalid text orientation value causes an error
"""
self
.
client
.
force_login
(
self
.
user
)
manual_tr_id
=
self
.
manual_transcription
.
id
response
=
self
.
client
.
patch
(
reverse
(
'
api:transcription-edit
'
,
kwargs
=
{
'
pk
'
:
manual_tr_id
}),
format
=
'
json
'
,
data
=
{
'
orientation
'
:
'
wobbly
'
}
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_400_BAD_REQUEST
)
self
.
assertEqual
(
response
.
json
(),
{
'
orientation
'
:
[
'
Value is not of type TextOrientation
'
]})
def
test_transcription_edit_orientation
(
self
):
"""
Assert it is possible to edit the text orientation with UpdateTranscription
"""
self
.
client
.
force_login
(
self
.
user
)
manual_tr_id
=
self
.
manual_transcription
.
id
response
=
self
.
client
.
put
(
reverse
(
'
api:transcription-edit
'
,
kwargs
=
{
'
pk
'
:
manual_tr_id
}),
format
=
'
json
'
,
data
=
{
'
text
'
:
'
a knight was living lonely
'
,
'
orientation
'
:
'
vertical-rl
'
,
}
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
self
.
manual_transcription
.
refresh_from_db
()
self
.
assertDictEqual
(
response
.
json
(),
{
'
id
'
:
str
(
manual_tr_id
),
'
confidence
'
:
None
,
'
score
'
:
None
,
'
text
'
:
'
a knight was living lonely
'
,
'
orientation
'
:
'
vertical-rl
'
,
'
worker_version_id
'
:
None
,
})
def
test_transcription_edit_invalid_orientation
(
self
):
"""
An invalid text orientation value causes an error
"""
self
.
client
.
force_login
(
self
.
user
)
manual_tr_id
=
self
.
manual_transcription
.
id
response
=
self
.
client
.
put
(
reverse
(
'
api:transcription-edit
'
,
kwargs
=
{
'
pk
'
:
manual_tr_id
}),
format
=
'
json
'
,
data
=
{
'
text
'
:
'
a knight was living lonely
'
,
'
orientation
'
:
'
wobbly
'
,
}
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_400_BAD_REQUEST
)
self
.
assertEqual
(
response
.
json
(),
{
'
orientation
'
:
[
'
Value is not of type TextOrientation
'
]})
def
test_transcription_patch_write_right
(
self
):
"""
A write right is required to patch a manual transcription
Loading