Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 62b5e412ca |
@@ -0,0 +1,3 @@
|
|||||||
|
# TieMeasureFlow#81: static del frontend sempre con LF, anche con core.autocrlf=true su Windows:
|
||||||
|
# le impronte sha256 di static/vendor/VERSIONS.md (test_offline.py) e il pacchetto Windows le vogliono identiche.
|
||||||
|
src/frontend/flask_app/static/** text=auto eol=lf
|
||||||
@@ -12,9 +12,12 @@ class TestSelectRecipe:
|
|||||||
|
|
||||||
def test_select_recipe_renders(self, logged_in_client, mock_api_client, monkeypatch):
|
def test_select_recipe_renders(self, logged_in_client, mock_api_client, monkeypatch):
|
||||||
"""Recipe selection page renders for MeasurementTec role."""
|
"""Recipe selection page renders for MeasurementTec role."""
|
||||||
# Patch the class attribute instead of reload()ing config/blueprints.measure:
|
monkeypatch.setenv("STATION_CODE", "ST-TEST")
|
||||||
# monkeypatch undoes it at teardown, so no ST-TEST leaks into later tests (#79).
|
import config
|
||||||
monkeypatch.setattr("blueprints.measure.Config.STATION_CODE", "ST-TEST")
|
import importlib
|
||||||
|
importlib.reload(config)
|
||||||
|
import blueprints.measure
|
||||||
|
importlib.reload(blueprints.measure)
|
||||||
|
|
||||||
mock_api_client.get_station_recipes.return_value = [
|
mock_api_client.get_station_recipes.return_value = [
|
||||||
{"id": 1, "code": "REC-001", "name": "Test Recipe"},
|
{"id": 1, "code": "REC-001", "name": "Test Recipe"},
|
||||||
@@ -44,9 +47,12 @@ class TestSelectRecipe:
|
|||||||
import re
|
import re
|
||||||
from html.parser import HTMLParser
|
from html.parser import HTMLParser
|
||||||
|
|
||||||
# Patch the class attribute instead of reload()ing config/blueprints.measure:
|
monkeypatch.setenv("STATION_CODE", "ST-TEST")
|
||||||
# monkeypatch undoes it at teardown, so no ST-TEST leaks into later tests (#79).
|
import config
|
||||||
monkeypatch.setattr("blueprints.measure.Config.STATION_CODE", "ST-TEST")
|
import importlib
|
||||||
|
importlib.reload(config)
|
||||||
|
import blueprints.measure
|
||||||
|
importlib.reload(blueprints.measure)
|
||||||
|
|
||||||
mock_api_client.get_station_recipes.return_value = []
|
mock_api_client.get_station_recipes.return_value = []
|
||||||
|
|
||||||
@@ -73,9 +79,12 @@ class TestSelectRecipe:
|
|||||||
self, logged_in_client, mock_api_client, monkeypatch
|
self, logged_in_client, mock_api_client, monkeypatch
|
||||||
):
|
):
|
||||||
"""#10: a lot number like ``L'23`` must not break the page."""
|
"""#10: a lot number like ``L'23`` must not break the page."""
|
||||||
# Patch the class attribute instead of reload()ing config/blueprints.measure:
|
monkeypatch.setenv("STATION_CODE", "ST-TEST")
|
||||||
# monkeypatch undoes it at teardown, so no ST-TEST leaks into later tests (#79).
|
import config
|
||||||
monkeypatch.setattr("blueprints.measure.Config.STATION_CODE", "ST-TEST")
|
import importlib
|
||||||
|
importlib.reload(config)
|
||||||
|
import blueprints.measure
|
||||||
|
importlib.reload(blueprints.measure)
|
||||||
|
|
||||||
mock_api_client.get_station_recipes.return_value = []
|
mock_api_client.get_station_recipes.return_value = []
|
||||||
|
|
||||||
@@ -384,13 +393,6 @@ class TestStartSequence:
|
|||||||
class TestTaskComplete:
|
class TestTaskComplete:
|
||||||
"""GET /measure/complete/<recipe_id> tests."""
|
"""GET /measure/complete/<recipe_id> tests."""
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
|
||||||
def _station(self, monkeypatch):
|
|
||||||
# The side_effect lists below include the /production-runs/current reply,
|
|
||||||
# which is only requested when a station is configured: pin it explicitly
|
|
||||||
# instead of relying on whatever an earlier test left behind (#79).
|
|
||||||
monkeypatch.setattr("blueprints.measure.Config.STATION_CODE", "ST-TEST")
|
|
||||||
|
|
||||||
def test_task_complete_renders(self, logged_in_client, mock_api_client):
|
def test_task_complete_renders(self, logged_in_client, mock_api_client):
|
||||||
"""The summary carries the measurement clock, so it has to render with it."""
|
"""The summary carries the measurement clock, so it has to render with it."""
|
||||||
mock_api_client.get.side_effect = [
|
mock_api_client.get.side_effect = [
|
||||||
|
|||||||
@@ -6,17 +6,6 @@ a start button that will not start, a description that reads the way it was
|
|||||||
written.
|
written.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
|
||||||
def _no_station(monkeypatch):
|
|
||||||
# These tests assume no station is configured (e.g. _task_list feeds the mock a
|
|
||||||
# fixed number of replies, with no /production-runs/current among them); pin it
|
|
||||||
# so a STATION_CODE left behind by an earlier test cannot change the call count (#79).
|
|
||||||
# Tests that need a station set it themselves, after this fixture has run.
|
|
||||||
monkeypatch.setattr("blueprints.measure.Config.STATION_CODE", None)
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Point 11 - line breaks and bold, and nothing else
|
# Point 11 - line breaks and bold, and nothing else
|
||||||
@@ -208,9 +197,13 @@ def test_avvia_is_untouched_when_nothing_is_required(
|
|||||||
def test_selection_screen_carries_the_traceability_rules(
|
def test_selection_screen_carries_the_traceability_rules(
|
||||||
logged_in_client, mock_api_client, monkeypatch,
|
logged_in_client, mock_api_client, monkeypatch,
|
||||||
):
|
):
|
||||||
# Patch instead of reload()ing config/blueprints.measure: the patch is undone at
|
monkeypatch.setenv("STATION_CODE", "ST-TEST")
|
||||||
# teardown, a reload would leave ST-TEST behind for later tests (#79).
|
import importlib
|
||||||
monkeypatch.setattr("blueprints.measure.Config.STATION_CODE", "ST-TEST")
|
|
||||||
|
import config
|
||||||
|
importlib.reload(config)
|
||||||
|
import blueprints.measure
|
||||||
|
importlib.reload(blueprints.measure)
|
||||||
|
|
||||||
mock_api_client.get_station_recipes.return_value = [
|
mock_api_client.get_station_recipes.return_value = [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user