Skip to content

Commit 64388e2

Browse files
committed
feat: Upgrade lib-cove-web
1 parent 1f57548 commit 64388e2

File tree

8 files changed

+79
-99
lines changed

8 files changed

+79
-99
lines changed

cove_ocds/locale/en/LC_MESSAGES/django.po

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2024-10-04 16:02+0000\n"
11+
"POT-Creation-Date: 2024-10-10 00:56+0000\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -23,8 +23,8 @@ msgstr ""
2323

2424
#: cove_ocds/lib/exceptions.py:14 cove_ocds/lib/exceptions.py:34
2525
#: cove_ocds/lib/exceptions.py:57 cove_ocds/lib/exceptions.py:77
26-
#: cove_ocds/views.py:93 cove_ocds/views.py:111 cove_ocds/views.py:129
27-
#: cove_ocds/views.py:248
26+
#: cove_ocds/views.py:90 cove_ocds/views.py:108 cove_ocds/views.py:126
27+
#: cove_ocds/views.py:237
2828
msgid "Try Again"
2929
msgstr ""
3030

@@ -205,12 +205,10 @@ msgid ""
205205
msgstr ""
206206

207207
#: cove_ocds/templates/cove_ocds/base.html:140
208-
#, python-format
209208
msgid ""
210-
"To preview how the data review tool works, try <a href=\"%(index_url)s?"
211-
"source_url=https://raw.githubusercontent.com/open-contracting/sample-data/"
212-
"main/fictional-example/1.1/ocds-213czf-000-00001-02-tender.json\"> loading "
213-
"some sample data. </a>"
209+
"To preview how the data review tool works, try loading: <code>https://raw."
210+
"githubusercontent.com/open-contracting/sample-data/main/fictional-"
211+
"example/1.1/ocds-213czf-000-00001-02-tender.json</code>"
214212
msgstr ""
215213

216214
#: cove_ocds/templates/cove_ocds/base.html:153
@@ -1381,39 +1379,39 @@ msgstr ""
13811379
msgid "Column"
13821380
msgstr ""
13831381

1384-
#: cove_ocds/templatetags/cove_ocds.py:11
1382+
#: cove_ocds/templatetags/cove_ocds.py:13
13851383
msgid ""
13861384
"This array should contain either entirely embedded releases or linked "
13871385
"releases. Embedded releases contain an 'id' whereas linked releases do not. "
13881386
"Your releases contain a mixture."
13891387
msgstr ""
13901388

1391-
#: cove_ocds/templatetags/cove_ocds.py:17
1389+
#: cove_ocds/templatetags/cove_ocds.py:19
13921390
#, python-format
13931391
msgid "%s is not valid under any of the given schemas"
13941392
msgstr ""
13951393

1396-
#: cove_ocds/templatetags/cove_ocds.py:20
1394+
#: cove_ocds/templatetags/cove_ocds.py:22
13971395
#, python-format
13981396
msgid "%(instance)s is valid under each of %(reprs)s"
13991397
msgstr ""
14001398

1401-
#: cove_ocds/templatetags/cove_ocds.py:29
1399+
#: cove_ocds/templatetags/cove_ocds.py:31
14021400
msgid ""
14031401
"Incorrect date format. Dates should use the form YYYY-MM-DDT00:00:00Z. Learn "
14041402
"more about <a href=\"https://standard.open-contracting.org/latest/en/schema/"
14051403
"reference/#date\">dates in OCDS</a>."
14061404
msgstr ""
14071405

1408-
#: cove_ocds/views.py:52
1406+
#: cove_ocds/views.py:50
14091407
msgid "Sorry, the page you are looking for is not available"
14101408
msgstr ""
14111409

1412-
#: cove_ocds/views.py:54
1410+
#: cove_ocds/views.py:52
14131411
msgid "Go to Home page"
14141412
msgstr ""
14151413

1416-
#: cove_ocds/views.py:57
1414+
#: cove_ocds/views.py:55
14171415
#, python-format
14181416
msgid ""
14191417
"The data you were hoping to explore no longer exists.\n"
@@ -1423,12 +1421,12 @@ msgid ""
14231421
"available."
14241422
msgstr ""
14251423

1426-
#: cove_ocds/views.py:91 cove_ocds/views.py:109 cove_ocds/views.py:127
1427-
#: cove_ocds/views.py:246
1424+
#: cove_ocds/views.py:88 cove_ocds/views.py:106 cove_ocds/views.py:124
1425+
#: cove_ocds/views.py:235
14281426
msgid "Sorry, we can't process that data"
14291427
msgstr ""
14301428

1431-
#: cove_ocds/views.py:96
1429+
#: cove_ocds/views.py:93
14321430
msgid ""
14331431
"The file that you uploaded doesn't appear to be well formed JSON. OCDS JSON "
14341432
"follows the I-JSON format, which requires UTF-8 encoding. Ensure that your "
@@ -1438,21 +1436,21 @@ msgid ""
14381436
"span> <strong>Error message:</strong> {}"
14391437
msgstr ""
14401438

1441-
#: cove_ocds/views.py:114
1439+
#: cove_ocds/views.py:111
14421440
msgid ""
14431441
"We think you tried to upload a JSON file, but it is not well formed JSON.\n"
14441442
"\n"
14451443
"<span class=\"glyphicon glyphicon-exclamation-sign\" aria-hidden=\"true\"></"
14461444
"span> <strong>Error message:</strong> {}"
14471445
msgstr ""
14481446

1449-
#: cove_ocds/views.py:130
1447+
#: cove_ocds/views.py:127
14501448
msgid ""
14511449
"OCDS JSON should have an object as the top level, the JSON you supplied does "
14521450
"not."
14531451
msgstr ""
14541452

1455-
#: cove_ocds/views.py:251
1453+
#: cove_ocds/views.py:240
14561454
msgid ""
14571455
"The table isn't structured correctly. For example, a JSON Pointer "
14581456
"(<code>tender</code>) can't be both a value (<code>tender</code>), a path to "

cove_ocds/locale/es/LC_MESSAGES/django.po

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ msgid ""
1515
msgstr ""
1616
"Project-Id-Version: PACKAGE VERSION\n"
1717
"Report-Msgid-Bugs-To: \n"
18-
"POT-Creation-Date: 2024-10-04 16:02+0000\n"
18+
"POT-Creation-Date: 2024-10-10 00:56+0000\n"
1919
"PO-Revision-Date: 2020-09-08 08:53+0000\n"
2020
"Last-Translator: James McKinney, 2024\n"
2121
"Language-Team: Spanish (https://app.transifex.com/open-contracting-"
@@ -33,8 +33,8 @@ msgstr "Versión del esquema no reconocida"
3333

3434
#: cove_ocds/lib/exceptions.py:14 cove_ocds/lib/exceptions.py:34
3535
#: cove_ocds/lib/exceptions.py:57 cove_ocds/lib/exceptions.py:77
36-
#: cove_ocds/views.py:93 cove_ocds/views.py:111 cove_ocds/views.py:129
37-
#: cove_ocds/views.py:248
36+
#: cove_ocds/views.py:90 cove_ocds/views.py:108 cove_ocds/views.py:126
37+
#: cove_ocds/views.py:237
3838
msgid "Try Again"
3939
msgstr "Inténtelo de nuevo"
4040

@@ -262,17 +262,15 @@ msgstr ""
262262
"discutir sobre la calidad de los datos."
263263

264264
#: cove_ocds/templates/cove_ocds/base.html:140
265-
#, python-format
266265
msgid ""
267-
"To preview how the data review tool works, try <a href=\"%(index_url)s?"
268-
"source_url=https://raw.githubusercontent.com/open-contracting/sample-data/"
269-
"main/fictional-example/1.1/ocds-213czf-000-00001-02-tender.json\"> loading "
270-
"some sample data. </a>"
266+
"To preview how the data review tool works, try loading: <code>https://raw."
267+
"githubusercontent.com/open-contracting/sample-data/main/fictional-"
268+
"example/1.1/ocds-213czf-000-00001-02-tender.json</code>"
271269
msgstr ""
272-
"Para ver cómo funciona la herramienta de revisión de datos, intente <a "
273-
"href=\"%(index_url)s?source_url=https://raw.githubusercontent.com/open-"
270+
"Para ver cómo funciona la herramienta de revisión de datos, intente subir "
271+
"<code>https://raw.githubusercontent.com/open-"
274272
"contracting/sample-data/main/fictional-example/1.1/ocds-213czf-000-00001-02-"
275-
"tender.json\"> subir algunos datos de muestra.</a>"
273+
"tender.json</code>"
276274

277275
#: cove_ocds/templates/cove_ocds/base.html:153
278276
msgid "Built by"
@@ -1632,7 +1630,7 @@ msgstr "Fila"
16321630
msgid "Column"
16331631
msgstr "Columna"
16341632

1635-
#: cove_ocds/templatetags/cove_ocds.py:11
1633+
#: cove_ocds/templatetags/cove_ocds.py:13
16361634
msgid ""
16371635
"This array should contain either entirely embedded releases or linked "
16381636
"releases. Embedded releases contain an 'id' whereas linked releases do not. "
@@ -1642,17 +1640,17 @@ msgstr ""
16421640
"vinculadas. Las entregas integradas contienen un \"identificador\", mientras "
16431641
"que las entregas vinculadas no. Estas entregas contienen una mezcla de ambos."
16441642

1645-
#: cove_ocds/templatetags/cove_ocds.py:17
1643+
#: cove_ocds/templatetags/cove_ocds.py:19
16461644
#, python-format
16471645
msgid "%s is not valid under any of the given schemas"
16481646
msgstr "%s no es válido bajo ninguno de los esquemas dados"
16491647

1650-
#: cove_ocds/templatetags/cove_ocds.py:20
1648+
#: cove_ocds/templatetags/cove_ocds.py:22
16511649
#, python-format
16521650
msgid "%(instance)s is valid under each of %(reprs)s"
16531651
msgstr "%(instance)s es válido bajo cada uno de %(reprs)s"
16541652

1655-
#: cove_ocds/templatetags/cove_ocds.py:29
1653+
#: cove_ocds/templatetags/cove_ocds.py:31
16561654
msgid ""
16571655
"Incorrect date format. Dates should use the form YYYY-MM-DDT00:00:00Z. Learn "
16581656
"more about <a href=\"https://standard.open-contracting.org/latest/en/schema/"
@@ -1662,15 +1660,15 @@ msgstr ""
16621660
"DDT00:00:00Z. Lea más sobre <a href=\"https://standard.open-contracting.org/"
16631661
"latest/es/schema/reference/#date\"> fechas en OCDS</a>"
16641662

1665-
#: cove_ocds/views.py:52
1663+
#: cove_ocds/views.py:50
16661664
msgid "Sorry, the page you are looking for is not available"
16671665
msgstr "Lo sentimos, la página que está buscando no está disponible"
16681666

1669-
#: cove_ocds/views.py:54
1667+
#: cove_ocds/views.py:52
16701668
msgid "Go to Home page"
16711669
msgstr "Ir a la Página de Inicio"
16721670

1673-
#: cove_ocds/views.py:57
1671+
#: cove_ocds/views.py:55
16741672
#, python-format
16751673
msgid ""
16761674
"The data you were hoping to explore no longer exists.\n"
@@ -1686,12 +1684,12 @@ msgstr ""
16861684
"automáticamente después de %s días, y por lo tanto el análisis de esos datos "
16871685
"ya no está disponible."
16881686

1689-
#: cove_ocds/views.py:91 cove_ocds/views.py:109 cove_ocds/views.py:127
1690-
#: cove_ocds/views.py:246
1687+
#: cove_ocds/views.py:88 cove_ocds/views.py:106 cove_ocds/views.py:124
1688+
#: cove_ocds/views.py:235
16911689
msgid "Sorry, we can't process that data"
16921690
msgstr "Lo sentimos, no podemos procesar esos datos"
16931691

1694-
#: cove_ocds/views.py:96
1692+
#: cove_ocds/views.py:93
16951693
msgid ""
16961694
"The file that you uploaded doesn't appear to be well formed JSON. OCDS JSON "
16971695
"follows the I-JSON format, which requires UTF-8 encoding. Ensure that your "
@@ -1708,7 +1706,7 @@ msgstr ""
17081706
"<span class=\"glyphicon glyphicon-exclamation-sign\" aria-hidden=\"true\"></"
17091707
"span> <strong>Mensaje del error:</strong> {}"
17101708

1711-
#: cove_ocds/views.py:114
1709+
#: cove_ocds/views.py:111
17121710
msgid ""
17131711
"We think you tried to upload a JSON file, but it is not well formed JSON.\n"
17141712
"\n"
@@ -1721,15 +1719,15 @@ msgstr ""
17211719
"<span class=\"glyphicon glyphicon-exclamation-sign\" aria-hidden=\"true\"></"
17221720
"span> <strong>Mensaje del error:</strong> {}"
17231721

1724-
#: cove_ocds/views.py:130
1722+
#: cove_ocds/views.py:127
17251723
msgid ""
17261724
"OCDS JSON should have an object as the top level, the JSON you supplied does "
17271725
"not."
17281726
msgstr ""
17291727
"OCDS JSON debe ser un objeto al nivel más alto pero el JSON que usted ha "
17301728
"aportado no lo es."
17311729

1732-
#: cove_ocds/views.py:251
1730+
#: cove_ocds/views.py:240
17331731
msgid ""
17341732
"The table isn't structured correctly. For example, a JSON Pointer "
17351733
"(<code>tender</code>) can't be both a value (<code>tender</code>), a path to "

cove_ocds/templates/cove_ocds/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ <h1 class="heading-in-panel"> <small> {% blocktrans %}Using the data review tool
137137
<p> {% blocktrans %}The application works with both <a href="https://standard.open-contracting.org/latest/en/primer/releases_and_records/">'release' and 'record'</a> OCDS documents that conform to the <a href="https://standard.open-contracting.org/">Open Data Contracting Standard</a> {%endblocktrans%} </p>
138138
<p> {% blocktrans %}If your data passes basic structural checks, the tool will then present a report on data quality, and information about the contents of your file. It will also offer alternative copies of the data for download. {%endblocktrans%} </p>
139139
<p> {% blocktrans %}Data is stored for {{ delete_files_after_days }} days at a randomly generated URL. You can share this link with others to support discussion of data quality. {%endblocktrans%} </p>
140-
<p> {% blocktrans %}To preview how the data review tool works, try <a href="{{ index_url }}?source_url=https://raw.githubusercontent.com/open-contracting/sample-data/main/fictional-example/1.1/ocds-213czf-000-00001-02-tender.json"> loading some sample data. </a>{% endblocktrans%} </p>
140+
<p> {% blocktrans %}To preview how the data review tool works, try loading: <code>https://raw.githubusercontent.com/open-contracting/sample-data/main/fictional-example/1.1/ocds-213czf-000-00001-02-tender.json</code>{% endblocktrans%}</p>
141141
</div>
142142
</div>
143143
</div>

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ libcove==0.32.1
7474
# libcoveweb
7575
libcoveocds==0.16.0
7676
# via -r requirements.in
77-
libcoveweb==0.30.4
77+
libcoveweb==0.30.5
7878
# via -r requirements.in
7979
lxml==4.9.1
8080
# via flattentool

requirements_dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ libcove==0.32.1
123123
# libcoveweb
124124
libcoveocds==0.16.0
125125
# via -r requirements.txt
126-
libcoveweb==0.30.4
126+
libcoveweb==0.30.5
127127
# via -r requirements.txt
128128
libsass==0.20.1
129129
# via -r requirements_dev.in

tests/conftest.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,16 @@ def server_url(live_server):
4444
@pytest.fixture()
4545
def url_input_browser(request, server_url, browser, httpserver):
4646
def _url_input_browser(source_filename, *, output_source_url=False):
47-
with open(os.path.join("tests", "fixtures", source_filename), "rb") as fp:
48-
httpserver.serve_content(fp.read())
49-
if "CUSTOM_SERVER_URL" in os.environ:
50-
# Use urls pointing to GitHub if we have a custom (probably non local) server URL
47+
if source_filename.startswith("http"):
48+
source_url = source_filename
49+
elif "CUSTOM_SERVER_URL" in os.environ:
5150
source_url = (
52-
"https://raw.githubusercontent.com/open-contracting/cove-ocds/main/tests/fixtures/" + source_filename
51+
f"https://raw.githubusercontent.com/open-contracting/cove-ocds/main/tests/fixtures/{source_filename}"
5352
)
5453
else:
55-
source_url = httpserver.url + "/" + source_filename
54+
with open(os.path.join("tests", "fixtures", source_filename), "rb") as fp:
55+
httpserver.serve_content(fp.read())
56+
source_url = f"{httpserver.url}/{source_filename}"
5657

5758
browser.get(server_url)
5859
time.sleep(0.5)

tests/test_functional.py

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,7 @@ def test_url_input(
467467
conversion_successful,
468468
)
469469

470-
selected_examples = ["tenders_releases_2_releases_invalid.json"]
471-
472-
if source_filename in selected_examples:
470+
if source_filename == "tenders_releases_2_releases_invalid.json":
473471
# refresh page to now check if tests still work after caching some data
474472
browser.get(browser.current_url)
475473
check_url_input_result_page(
@@ -481,16 +479,6 @@ def test_url_input(
481479
not_expected_text,
482480
conversion_successful,
483481
)
484-
browser.get(server_url + "?source_url=" + source_url)
485-
check_url_input_result_page(
486-
server_url,
487-
browser,
488-
httpserver,
489-
source_filename,
490-
expected_text,
491-
not_expected_text,
492-
conversion_successful,
493-
)
494482

495483

496484
def check_url_input_result_page(
@@ -658,7 +646,7 @@ def test_extension_validation_error_messages(url_input_browser):
658646

659647

660648
@pytest.mark.parametrize("flatten_or_unflatten", ["flatten", "unflatten"])
661-
def test_flattentool_warnings(server_url, browser, httpserver, monkeypatch, flatten_or_unflatten):
649+
def test_flattentool_warnings(server_url, url_input_browser, httpserver, monkeypatch, flatten_or_unflatten):
662650
# If we're testing a remove server then we can't run this test as we can't
663651
# set up the mocks
664652
if "CUSTOM_SERVER_URL" in os.environ:
@@ -681,23 +669,22 @@ def mockunflatten(input_name, output_name, *args, **kwargs):
681669
fp.write("{}")
682670

683671
def mockflatten(input_name, output_name, *args, **kwargs):
684-
with open(output_name + ".xlsx", "w") as fp:
672+
with open(f"{output_name}.xlsx", "w") as fp:
685673
fp.write("{}")
686674

687675
mocks = {"flatten": mockflatten, "unflatten": mockunflatten}
688676
monkeypatch.setattr(flattentool, flatten_or_unflatten, mocks[flatten_or_unflatten])
689677

690-
with open(os.path.join("tests", "fixtures", source_filename), "rb") as fp:
691-
httpserver.serve_content(fp.read())
692678
if "CUSTOM_SERVER_URL" in os.environ:
693-
# Use urls pointing to GitHub if we have a custom (probably non local) server URL
694679
source_url = (
695-
"https://raw.githubusercontent.com/open-contracting/cove-ocds/main/tests/fixtures/" + source_filename
680+
f"https://raw.githubusercontent.com/open-contracting/cove-ocds/main/tests/fixtures/{source_filename}"
696681
)
697682
else:
698-
source_url = httpserver.url + "/" + source_filename
683+
with open(os.path.join("tests", "fixtures", source_filename), "rb") as fp:
684+
httpserver.serve_content(fp.read())
685+
source_url = f"{httpserver.url}/{source_filename}"
699686

700-
browser.get(server_url + "?source_url=" + source_url)
687+
browser = url_input_browser(source_url)
701688

702689
if source_filename.endswith(".json"):
703690
browser.find_element(By.NAME, "flatten").click()

0 commit comments

Comments
 (0)