Skip to content
Snippets Groups Projects

Prevent calls to the Transkribus API in unit tests

Merged Erwan Rouchet requested to merge missing-transkribus-mock into master
1 file
+ 4
1
Compare changes
  • Side-by-side
  • Inline
@@ -47,7 +47,10 @@ class TestTranskribusImport(FixtureAPITestCase):
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertEqual(response.json(), {"__all__": ["You have not register your transkribus email"]})
def test_arkindex_has_not_access(self):
@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
mock_transkribus.side_effect = Exception("401 Unauthorized")
self.client.force_login(self.user)
response = self.client.post(reverse("api:import-transkribus"), {
"collection_id": "12345",
Loading