udata 12.0.2.dev5__py3-none-any.whl → 12.0.2.dev7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of udata might be problematic. Click here for more details.

@@ -20,6 +20,7 @@ from udata.core.topic.factories import (
20
20
  )
21
21
  from udata.core.topic.models import Topic, TopicElement
22
22
  from udata.core.user.factories import UserFactory
23
+ from udata.i18n import _
23
24
  from udata.tests.api import APITestCase
24
25
  from udata.tests.api.test_datasets_api import SAMPLE_GEOM
25
26
  from udata.tests.features.territories import create_geozones_fixtures
@@ -496,7 +497,7 @@ class TopicElementsAPITest(APITestCase):
496
497
 
497
498
  def test_elements_list_pagination(self):
498
499
  topic = TopicFactory()
499
- for _ in range(DEFAULT_PAGE_SIZE + 1):
500
+ for i in range(DEFAULT_PAGE_SIZE + 1):
500
501
  TopicElementFactory(topic=topic)
501
502
  response = self.get(url_for("apiv2.topic_elements", topic=topic))
502
503
  assert response.status_code == 200
@@ -717,9 +718,8 @@ class TopicElementsAPITest(APITestCase):
717
718
  topic = TopicFactory(owner=owner)
718
719
  response = self.post(url_for("apiv2.topic_elements", topic=topic), [{}])
719
720
  assert response.status_code == 400
720
- assert (
721
- response.json["errors"][0]["element"][0]
722
- == "A topic element must have a title or an element."
721
+ assert response.json["errors"][0]["element"][0] == _(
722
+ "A topic element must have a title or an element."
723
723
  )
724
724
 
725
725
  def test_add_datasets_perm(self):
@@ -2,6 +2,8 @@ from uuid import uuid4
2
2
 
3
3
  from flask import url_for
4
4
 
5
+ from udata.i18n import _
6
+
5
7
  from . import FrontTestCase
6
8
 
7
9
 
@@ -17,10 +19,12 @@ class ErrorHandlersTest(FrontTestCase):
17
19
  # Check that the custom 404 template is rendered
18
20
  html = response.data.decode("utf-8")
19
21
  assert "404" in html
20
- assert "Page not found" in html or "page you are looking for does not exist" in html.lower()
22
+ assert (
23
+ _("Page not found") in html or _("The page you are looking for does not exist.") in html
24
+ )
21
25
 
22
26
  # Check that there's a link back to the homepage
23
- assert "Back to home" in html or "home" in html.lower()
27
+ assert _("Back to home") in html or _("Home").lower() in html.lower()
24
28
 
25
29
  def test_404_with_abort_function_requesting_html(self):
26
30
  """Test that resource redirect returns HTML 404 when HTML is requested"""
@@ -41,7 +45,9 @@ class ErrorHandlersTest(FrontTestCase):
41
45
  # Check that the custom 404 template is rendered
42
46
  html = response.data.decode("utf-8")
43
47
  assert "404" in html
44
- assert "Page not found" in html or "page you are looking for does not exist" in html.lower()
48
+ assert (
49
+ _("Page not found") in html or _("The page you are looking for does not exist.") in html
50
+ )
45
51
 
46
52
  def test_404_in_flask_routing(self):
47
53
  """Test that a 404 error returns JSON when requested"""
Binary file