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
Commits
4d92ad94
Commit
4d92ad94
authored
2 years ago
by
Erwan Rouchet
Committed by
Bastien Abadie
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add missing feature flag overrides on Transkribus import tests
parent
d357c5c3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1849
Add missing feature flag overrides on Transkribus import tests
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arkindex/process/tests/test_transkribus_import.py
+8
-2
8 additions, 2 deletions
arkindex/process/tests/test_transkribus_import.py
with
8 additions
and
2 deletions
arkindex/process/tests/test_transkribus_import.py
+
8
−
2
View file @
4d92ad94
...
...
@@ -43,6 +43,7 @@ class TestTranskribusImport(FixtureAPITestCase):
configuration
=
{}
)
@override_settings
(
ARKINDEX_FEATURES
=
{
"
transkribus
"
:
True
})
def
test_requires_login
(
self
):
response
=
self
.
client
.
post
(
reverse
(
"
api:import-transkribus
"
))
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_403_FORBIDDEN
)
...
...
@@ -56,6 +57,7 @@ class TestTranskribusImport(FixtureAPITestCase):
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_400_BAD_REQUEST
)
self
.
assertEqual
(
response
.
json
(),
[
"
Transkribus import is unavailable due to the transkribus feature being disabled.
"
])
@override_settings
(
ARKINDEX_FEATURES
=
{
"
transkribus
"
:
True
})
def
test_requires_transkribus_email
(
self
):
User
.
objects
.
update
(
transkribus_email
=
None
)
self
.
client
.
force_login
(
self
.
user
)
...
...
@@ -65,6 +67,7 @@ class TestTranskribusImport(FixtureAPITestCase):
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_400_BAD_REQUEST
)
self
.
assertEqual
(
response
.
json
(),
{
"
__all__
"
:
[
"
You have not registered your transkribus email
"
]})
@override_settings
(
ARKINDEX_FEATURES
=
{
"
transkribus
"
:
True
})
@patch
(
"
transkribus.TranskribusAPI.list_user_collection
"
)
def
test_arkindex_has_not_access
(
self
,
mock_transkribus
):
# Not a mistake: Transkribus client raises `Exception` directly when it runs out of retries
...
...
@@ -76,6 +79,7 @@ class TestTranskribusImport(FixtureAPITestCase):
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_400_BAD_REQUEST
)
self
.
assertEqual
(
response
.
json
(),
{
"
collection_id
"
:
[
"
User arkindex@teklia.com is not a member of the collection 12345
"
]})
@override_settings
(
ARKINDEX_FEATURES
=
{
"
transkribus
"
:
True
})
@patch
(
"
transkribus.TranskribusAPI.list_user_collection
"
)
def
test_user_has_not_access
(
self
,
mock_transkribus
):
mock_transkribus
.
return_value
=
[{
"
email
"
:
"
arkindex@teklia.com
"
}]
...
...
@@ -88,7 +92,8 @@ class TestTranskribusImport(FixtureAPITestCase):
self
.
assertEqual
(
response
.
json
(),
{
"
collection_id
"
:
[
"
User nope@nope.fr is not a member of the collection 12345
"
]})
@override_settings
(
PONOS_RECIPE
=
{}
PONOS_RECIPE
=
{},
ARKINDEX_FEATURES
=
{
"
transkribus
"
:
True
},
)
@patch
(
"
transkribus.TranskribusAPI.list_user_collection
"
)
def
test_create_import
(
self
,
mock_transkribus
):
...
...
@@ -154,7 +159,8 @@ class TestTranskribusImport(FixtureAPITestCase):
})
@override_settings
(
PONOS_RECIPE
=
{}
PONOS_RECIPE
=
{},
ARKINDEX_FEATURES
=
{
'
transkribus
'
:
True
},
)
@patch
(
"
transkribus.TranskribusAPI.list_user_collection
"
)
def
test_corpus_worker_version_list_transkribus
(
self
,
mock_transkribus
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment