🛡️ Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!
Fix #289: complete currency symbol-to-code maps so non-USD defaults resolve
Omega (QA)7c7744228c2e
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 5a400a4..5c424b6 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -46,6 +46,9 @@- **Docker folder compose file fixed (install):** `Docker/docker-compose.yml` shipped with its DB_ADMIN_PASSWORD environment line dedented to the start of the line, which made the whole file invalid YAML that Docker Compose could not parse, and its SECRET_KEY line read a variable named APP_SECRET_KEY that neither shipped env example defines, so a SECRET_KEY set the documented way was silently ignored and the generated-key fallback used instead. The line is now indented with the rest of the environment block, and SECRET_KEY reads ${SECRET_KEY:-}, matching Docker/.env.example, env.example, and the root compose file. The rest of the file was checked for the same classes of defect and is clean.- _Files: `Docker/docker-compose.yml`, `tests/test_compose_cfg05.py`_+- **Total Value no longer zero for most currencies (#289):** the dashboard Total Value sums only warranties in the user's default currency, but the symbol-to-code lookups behind it covered only 18 of the 89 supported currencies, so anyone whose default currency was outside that short list (reported for the Serbian Dinar, дин) silently fell back to US dollars and saw a Total Value of 0.00 in their own symbol. All five copies of the lookup (statistics, warranty create/update, CSV import, and both frontend fallbacks) are now completed from the supported-currency list: every symbol that belongs to exactly one supported currency resolves to it, 73 entries in each copy. Symbols shared by several currencies keep their established resolution ($ to USD, £ to GBP, ¥ to JPY, ₩ to KRW, kr to SEK), and Rs, K, and L stay unmapped because the stored symbol alone cannot distinguish their currencies.+ - _Files: `backend/statistics_routes.py`, `backend/warranties_routes.py`, `frontend/js/lib/currency.js`, `frontend/script.js`, `tests/test_currency_symbol_maps.py`_+# 1.0.4 - 2026-10-31- **Claim documents (issue #148):** claims can now carry documents — claim approval or rejection letters, photos of the defect, repair invoices, and similar evidence. Each claim shows a Documents section in the claims view: attach a file directly, or upload it to Paperless-ngx and link it, then view or remove it from the same place. Access follows the warranty's other documents: the owner and admins only, never shared through global view. Deleting a claim or its warranty removes the attached local files from disk; Paperless documents are unlinked, never deleted from Paperless.diff --git a/backend/statistics_routes.py b/backend/statistics_routes.pyindex a3a59c9..bc313c1 100644--- a/backend/statistics_routes.py+++ b/backend/statistics_routes.py@@ -24,10 +24,24 @@ logger = logging.getLogger(__name__)# Issue #192: the Total Value card sums only the default currency.CURRENCY_SYMBOL_TO_CODE = {'$': 'USD', '\u20ac': 'EUR', '\u00a3': 'GBP', '\u00a5': 'JPY',- '\u20b9': 'INR', '\u20a9': 'KRW', 'CHF': 'CHF', 'C$': 'CAD', 'A$': 'AUD',- 'kr': 'SEK', 'z\u0142': 'PLN', 'K\u010d': 'CZK', 'Ft': 'HUF',- '\u20bd': 'RUB', 'R$': 'BRL', '\u20aa': 'ILS', '\u20ba': 'TRY',- 'NZ$': 'NZD',+ '\u20b9': 'INR', '\u20a9': 'KRW', 'CHF': 'CHF', 'C$': 'CAD',+ 'A$': 'AUD', 'kr': 'SEK', 'z\u0142': 'PLN', 'K\u010d': 'CZK',+ 'Ft': 'HUF', '\u20bd': 'RUB', 'R$': 'BRL', '\u20aa': 'ILS',+ '\u20ba': 'TRY', 'NZ$': 'NZD', '\u043b\u0432': 'BGN', 'lei': 'RON',+ 'kn': 'HRK', 'S/': 'PEN', 'Bs': 'VES', 'R': 'ZAR',+ '\u20a6': 'NGN', 'KSh': 'KES', '\u20b5': 'GHS', 'DH': 'MAD',+ 'DT': 'TND', 'AED': 'AED', 'SR': 'SAR', 'QR': 'QAR',+ 'KD': 'KWD', 'BD': 'BHD', 'OR': 'OMR', 'JD': 'JOD',+ 'LL': 'LBP', '\ufdfc': 'IRR', '\u20a8': 'PKR', '\u09f3': 'BDT',+ 'Nu': 'BTN', '\u0e3f': 'THB', '\u20ab': 'VND', '\u20ad': 'LAK',+ '\u17db': 'KHR', 'RM': 'MYR', 'S$': 'SGD', 'Rp': 'IDR',+ '\u20b1': 'PHP', 'NT$': 'TWD', 'HK$': 'HKD', 'MOP': 'MOP',+ '\u20ae': 'MNT', '\u20b8': 'KZT', 'so\u02bbm': 'UZS', 'SM': 'TJS',+ '\u0441': 'KGS', 'T': 'TMT', '\u060b': 'AFN', '\u058f': 'AMD',+ '\u20bc': 'AZN', '\u20be': 'GEL', '\u20b4': 'UAH', 'Br': 'BYN',+ '\u0434\u0438\u043d': 'RSD', '\u0434\u0435\u043d': 'MKD', 'KM': 'BAM', 'FJ$': 'FJD',+ 'SI$': 'SBD', 'T$': 'TOP', 'VT': 'VUV', 'WS$': 'WST',+ '\u20a3': 'XPF'}def get_user_currency_code(cur, user_id):diff --git a/backend/warranties_routes.py b/backend/warranties_routes.pyindex f9bd95b..cfa76ea 100644--- a/backend/warranties_routes.py+++ b/backend/warranties_routes.py@@ -133,10 +133,25 @@ def download_product_photo(url):# Map of currency symbols to ISO codes (mirrors frontend js/lib/currency.js).# Used to resolve a user's preferred currency symbol to a code for new warranties.SYMBOL_TO_CURRENCY_CODE = {- '$': 'USD', '€': 'EUR', '£': 'GBP', '¥': 'JPY', '₹': 'INR', '₩': 'KRW',- 'CHF': 'CHF', 'C$': 'CAD', 'A$': 'AUD', 'kr': 'SEK', 'zł': 'PLN',- 'Kč': 'CZK', 'Ft': 'HUF', '₽': 'RUB', 'R$': 'BRL', '₪': 'ILS',- '₺': 'TRY', 'NZ$': 'NZD',+ '$': 'USD', '€': 'EUR', '£': 'GBP', '¥': 'JPY',+ '₹': 'INR', '₩': 'KRW', 'CHF': 'CHF', 'C$': 'CAD',+ 'A$': 'AUD', 'kr': 'SEK', 'zł': 'PLN', 'Kč': 'CZK',+ 'Ft': 'HUF', '₽': 'RUB', 'R$': 'BRL', '₪': 'ILS',+ '₺': 'TRY', 'NZ$': 'NZD', 'лв': 'BGN', 'lei': 'RON',+ 'kn': 'HRK', 'S/': 'PEN', 'Bs': 'VES', 'R': 'ZAR',+ '₦': 'NGN', 'KSh': 'KES', '₵': 'GHS', 'DH': 'MAD',+ 'DT': 'TND', 'AED': 'AED', 'SR': 'SAR', 'QR': 'QAR',+ 'KD': 'KWD', 'BD': 'BHD', 'OR': 'OMR', 'JD': 'JOD',+ 'LL': 'LBP', '﷼': 'IRR', '₨': 'PKR', '৳': 'BDT',+ 'Nu': 'BTN', '฿': 'THB', '₫': 'VND', '₭': 'LAK',+ '៛': 'KHR', 'RM': 'MYR', 'S$': 'SGD', 'Rp': 'IDR',+ '₱': 'PHP', 'NT$': 'TWD', 'HK$': 'HKD', 'MOP': 'MOP',+ '₮': 'MNT', '₸': 'KZT', 'soʻm': 'UZS', 'SM': 'TJS',+ 'с': 'KGS', 'T': 'TMT', '؋': 'AFN', '֏': 'AMD',+ '₼': 'AZN', '₾': 'GEL', '₴': 'UAH', 'Br': 'BYN',+ 'дин': 'RSD', 'ден': 'MKD', 'KM': 'BAM', 'FJ$': 'FJD',+ 'SI$': 'SBD', 'T$': 'TOP', 'VT': 'VUV', 'WS$': 'WST',+ '₣': 'XPF'}def get_user_currency_code(user_id):@@ -1705,13 +1720,25 @@ def import_warranties():user_symbol = currency_result[0]# Map common currency symbols to currency codes (same as frontend logic)symbol_to_currency_map = {- '$': 'USD', '€': 'EUR', '£': 'GBP', '¥': 'JPY', '₹': 'INR', '₩': 'KRW',- 'CHF': 'CHF', 'C$': 'CAD', 'A$': 'AUD', 'kr': 'SEK', 'zł': 'PLN',- 'Kč': 'CZK', 'Ft': 'HUF', '₽': 'RUB', 'R$': 'BRL', '₦': 'NGN',- '₪': 'ILS', '₺': 'TRY', '₨': 'PKR', '৳': 'BDT', '฿': 'THB',- '₫': 'VND', 'RM': 'MYR', 'S$': 'SGD', 'Rp': 'IDR', '₱': 'PHP',- 'NT$': 'TWD', 'HK$': 'HKD', '₮': 'MNT', '₸': 'KZT', '₼': 'AZN',- '₾': 'GEL', '₴': 'UAH', 'NZ$': 'NZD'+ '$': 'USD', '€': 'EUR', '£': 'GBP', '¥': 'JPY',+ '₹': 'INR', '₩': 'KRW', 'CHF': 'CHF', 'C$': 'CAD',+ 'A$': 'AUD', 'kr': 'SEK', 'zł': 'PLN', 'Kč': 'CZK',+ 'Ft': 'HUF', '₽': 'RUB', 'R$': 'BRL', '₦': 'NGN',+ '₪': 'ILS', '₺': 'TRY', '₨': 'PKR', '৳': 'BDT',+ '฿': 'THB', '₫': 'VND', 'RM': 'MYR', 'S$': 'SGD',+ 'Rp': 'IDR', '₱': 'PHP', 'NT$': 'TWD', 'HK$': 'HKD',+ '₮': 'MNT', '₸': 'KZT', '₼': 'AZN', '₾': 'GEL',+ '₴': 'UAH', 'NZ$': 'NZD', 'лв': 'BGN', 'lei': 'RON',+ 'kn': 'HRK', 'S/': 'PEN', 'Bs': 'VES', 'R': 'ZAR',+ 'KSh': 'KES', '₵': 'GHS', 'DH': 'MAD', 'DT': 'TND',+ 'AED': 'AED', 'SR': 'SAR', 'QR': 'QAR', 'KD': 'KWD',+ 'BD': 'BHD', 'OR': 'OMR', 'JD': 'JOD', 'LL': 'LBP',+ '﷼': 'IRR', 'Nu': 'BTN', '₭': 'LAK', '៛': 'KHR',+ 'MOP': 'MOP', 'soʻm': 'UZS', 'SM': 'TJS', 'с': 'KGS',+ 'T': 'TMT', '؋': 'AFN', '֏': 'AMD', 'Br': 'BYN',+ 'дин': 'RSD', 'ден': 'MKD', 'KM': 'BAM', 'FJ$': 'FJD',+ 'SI$': 'SBD', 'T$': 'TOP', 'VT': 'VUV', 'WS$': 'WST',+ '₣': 'XPF'}if user_symbol in symbol_to_currency_map:diff --git a/frontend/js/lib/currency.js b/frontend/js/lib/currency.jsindex 105c3b8..aacb5df 100644--- a/frontend/js/lib/currency.js+++ b/frontend/js/lib/currency.js@@ -33,9 +33,25 @@ export function getCurrencyCode() {if (explicit) return explicit;const symbol = getCurrencySymbol();const map = {- '$': 'USD', '€': 'EUR', '£': 'GBP', '¥': 'JPY', '₹': 'INR', '₩': 'KRW',- 'CHF': 'CHF', 'C$': 'CAD', 'A$': 'AUD', 'kr': 'SEK', 'zł': 'PLN', 'Kč': 'CZK',- 'Ft': 'HUF', '₽': 'RUB', 'R$': 'BRL', '₪': 'ILS', '₺': 'TRY', 'NZ$': 'NZD',+ '$': 'USD', '€': 'EUR', '£': 'GBP', '¥': 'JPY',+ '₹': 'INR', '₩': 'KRW', 'CHF': 'CHF', 'C$': 'CAD',+ 'A$': 'AUD', 'kr': 'SEK', 'zł': 'PLN', 'Kč': 'CZK',+ 'Ft': 'HUF', '₽': 'RUB', 'R$': 'BRL', '₪': 'ILS',+ '₺': 'TRY', 'NZ$': 'NZD', 'лв': 'BGN', 'lei': 'RON',+ 'kn': 'HRK', 'S/': 'PEN', 'Bs': 'VES', 'R': 'ZAR',+ '₦': 'NGN', 'KSh': 'KES', '₵': 'GHS', 'DH': 'MAD',+ 'DT': 'TND', 'AED': 'AED', 'SR': 'SAR', 'QR': 'QAR',+ 'KD': 'KWD', 'BD': 'BHD', 'OR': 'OMR', 'JD': 'JOD',+ 'LL': 'LBP', '﷼': 'IRR', '₨': 'PKR', '৳': 'BDT',+ 'Nu': 'BTN', '฿': 'THB', '₫': 'VND', '₭': 'LAK',+ '៛': 'KHR', 'RM': 'MYR', 'S$': 'SGD', 'Rp': 'IDR',+ '₱': 'PHP', 'NT$': 'TWD', 'HK$': 'HKD', 'MOP': 'MOP',+ '₮': 'MNT', '₸': 'KZT', 'soʻm': 'UZS', 'SM': 'TJS',+ 'с': 'KGS', 'T': 'TMT', '؋': 'AFN', '֏': 'AMD',+ '₼': 'AZN', '₾': 'GEL', '₴': 'UAH', 'Br': 'BYN',+ 'дин': 'RSD', 'ден': 'MKD', 'KM': 'BAM', 'FJ$': 'FJD',+ 'SI$': 'SBD', 'T$': 'TOP', 'VT': 'VUV', 'WS$': 'WST',+ '₣': 'XPF'};return map[symbol] || 'USD';}diff --git a/frontend/script.js b/frontend/script.jsindex 4795972..a1a7ba2 100644--- a/frontend/script.js+++ b/frontend/script.js@@ -6583,13 +6583,25 @@ function getCurrencyCode() {// Fallback: Try to derive currency code from symbolconst symbol = getCurrencySymbol();const symbolToCurrencyMap = {- '$': 'USD', '€': 'EUR', '£': 'GBP', '¥': 'JPY', '₹': 'INR', '₩': 'KRW',- 'CHF': 'CHF', 'C$': 'CAD', 'A$': 'AUD', 'kr': 'SEK', 'zł': 'PLN',- 'Kč': 'CZK', 'Ft': 'HUF', '₽': 'RUB', 'R$': 'BRL', '₦': 'NGN',- '₪': 'ILS', '₺': 'TRY', '₨': 'PKR', '৳': 'BDT', '฿': 'THB',- '₫': 'VND', 'RM': 'MYR', 'S$': 'SGD', 'Rp': 'IDR', '₱': 'PHP',- 'NT$': 'TWD', 'HK$': 'HKD', '₮': 'MNT', '₸': 'KZT', '₼': 'AZN',- '₾': 'GEL', '₴': 'UAH', 'NZ$': 'NZD'+ '$': 'USD', '€': 'EUR', '£': 'GBP', '¥': 'JPY',+ '₹': 'INR', '₩': 'KRW', 'CHF': 'CHF', 'C$': 'CAD',+ 'A$': 'AUD', 'kr': 'SEK', 'zł': 'PLN', 'Kč': 'CZK',+ 'Ft': 'HUF', '₽': 'RUB', 'R$': 'BRL', '₦': 'NGN',+ '₪': 'ILS', '₺': 'TRY', '₨': 'PKR', '৳': 'BDT',+ '฿': 'THB', '₫': 'VND', 'RM': 'MYR', 'S$': 'SGD',+ 'Rp': 'IDR', '₱': 'PHP', 'NT$': 'TWD', 'HK$': 'HKD',+ '₮': 'MNT', '₸': 'KZT', '₼': 'AZN', '₾': 'GEL',+ '₴': 'UAH', 'NZ$': 'NZD', 'лв': 'BGN', 'lei': 'RON',+ 'kn': 'HRK', 'S/': 'PEN', 'Bs': 'VES', 'R': 'ZAR',+ 'KSh': 'KES', '₵': 'GHS', 'DH': 'MAD', 'DT': 'TND',+ 'AED': 'AED', 'SR': 'SAR', 'QR': 'QAR', 'KD': 'KWD',+ 'BD': 'BHD', 'OR': 'OMR', 'JD': 'JOD', 'LL': 'LBP',+ '﷼': 'IRR', 'Nu': 'BTN', '₭': 'LAK', '៛': 'KHR',+ 'MOP': 'MOP', 'soʻm': 'UZS', 'SM': 'TJS', 'с': 'KGS',+ 'T': 'TMT', '؋': 'AFN', '֏': 'AMD', 'Br': 'BYN',+ 'дин': 'RSD', 'ден': 'MKD', 'KM': 'BAM', 'FJ$': 'FJD',+ 'SI$': 'SBD', 'T$': 'TOP', 'VT': 'VUV', 'WS$': 'WST',+ '₣': 'XPF'};if (symbolToCurrencyMap[symbol]) {diff --git a/tests/test_currency_symbol_maps.py b/tests/test_currency_symbol_maps.pynew file mode 100644index 0000000..fa69d1e--- /dev/null+++ b/tests/test_currency_symbol_maps.py@@ -0,0 +1,177 @@+"""Issue #289: currency symbol-to-code maps omitted most supported symbols.++A user whose default currency is the Serbian Dinar (symbol дин) saw a+Total Value of 0: the symbol maps never resolved дин to RSD, so the+default fell back to USD and every RSD warranty was excluded from the+sum (the #192 rule sums only the default currency, plus rows with no+currency recorded).++The maps are now completed from the canonical supported-currency list+(the /api/currencies list in backend/warranties_routes.py): every+symbol that belongs to exactly one supported code resolves to it.+Symbols shared by several supported codes keep their established+resolution ($ -> USD, £ -> GBP, ¥ -> JPY, ₩ -> KRW, kr -> SEK); the+fully ambiguous Rs, K, and L stay unmapped, because the server stores+only the symbol and cannot tell LKR from NPR, MMK from PGK, or MDL+from ALL in this pass.+"""+import ast+import io+import os+import re++REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))+++def _read(relpath):+ with open(os.path.join(REPO_ROOT, relpath), encoding="utf-8") as fh:+ return fh.read()+++def _expected_map():+ """Derive the expected symbol->code map from the canonical list."""+ src = _read("backend/warranties_routes.py")+ m = re.search(r"def get_currencies.*?currencies = (\[.*?\])\s*\n", src, re.S)+ currencies = ast.literal_eval(m.group(1))+ by_symbol = {}+ for entry in currencies:+ by_symbol.setdefault(entry["symbol"], []).append(entry["code"])+ expected = {s: codes[0] for s, codes in by_symbol.items() if len(codes) == 1}+ # Established resolutions for shared symbols, unchanged by #289.+ expected.update({"$": "USD", "£": "GBP", "¥": "JPY", "₩": "KRW", "kr": "SEK"})+ return expected+++def _python_map(relpath, pattern):+ return ast.literal_eval(re.search(pattern, _read(relpath), re.S).group(1))+++def _js_map(relpath, pattern):+ return ast.literal_eval(re.search(pattern, _read(relpath), re.S).group(1))+++def test_all_five_maps_match_canonical_list():+ expected = _expected_map()+ assert expected["дин"] == "RSD"+ maps = {+ "statistics CURRENCY_SYMBOL_TO_CODE": _python_map(+ "backend/statistics_routes.py", r"CURRENCY_SYMBOL_TO_CODE = (\{.*?\})"),+ "warranties SYMBOL_TO_CURRENCY_CODE": _python_map(+ "backend/warranties_routes.py", r"SYMBOL_TO_CURRENCY_CODE = (\{.*?\})"),+ "warranties CSV import map": _python_map(+ "backend/warranties_routes.py", r"symbol_to_currency_map = (\{.*?\})"),+ "currency.js getCurrencyCode map": _js_map(+ "frontend/js/lib/currency.js", r"const map = (\{.*?\});"),+ "script.js symbolToCurrencyMap": _js_map(+ "frontend/script.js", r"const symbolToCurrencyMap = (\{.*?\});"),+ }+ for name, mapping in maps.items():+ assert mapping == expected, (+ f"{name} differs: missing={ {k: v for k, v in expected.items() if mapping.get(k) != v} }, "+ f"extra={ {k: v for k, v in mapping.items() if k not in expected} }")+ # Fully ambiguous symbols stay unmapped by design.+ for symbol in ("Rs", "K", "L"):+ assert symbol not in mapping+++def test_statistics_get_user_currency_code_resolves_din():+ from backend.statistics_routes import get_user_currency_code++ class FakeCursor:+ def __init__(self, symbol):+ self._symbol = symbol++ def execute(self, *args, **kwargs):+ pass++ def fetchone(self):+ return (self._symbol,)++ assert get_user_currency_code(FakeCursor("дин"), 1) == "RSD"+ assert get_user_currency_code(FakeCursor("$"), 1) == "USD"+ assert get_user_currency_code(FakeCursor(None), 1) == "USD"+++def _set_currency_symbol(db_connection, username, symbol):+ with db_connection, db_connection.cursor() as cur:+ cur.execute("SELECT id FROM users WHERE username = %s", (username,))+ user_id = cur.fetchone()[0]+ cur.execute(+ "INSERT INTO user_preferences (user_id, currency_symbol) VALUES (%s, %s) "+ "ON CONFLICT (user_id) DO UPDATE SET currency_symbol = EXCLUDED.currency_symbol",+ (user_id, symbol),+ )+ return user_id+++def _stored_currency(db_connection, warranty_id):+ with db_connection, db_connection.cursor() as cur:+ cur.execute("SELECT currency FROM warranties WHERE id = %s", (warranty_id,))+ return cur.fetchone()[0]+++def test_rsd_user_total_value_statistics_and_global(client, user_factory,+ warranty_factory,+ db_connection):+ user = user_factory()+ h = user["headers"]+ _set_currency_symbol(db_connection, user["username"], "дин")++ # The warranties-side resolver (create/update fallback) also returns RSD.+ from backend.warranties_routes import get_user_currency_code as wr_code+ with db_connection, db_connection.cursor() as cur:+ cur.execute("SELECT id FROM users WHERE username = %s", (user["username"],))+ assert wr_code(cur.fetchone()[0]) == "RSD"++ def _global_total():+ r = client.get("/api/statistics/global", headers=h)+ assert r.status_code == 200, r.get_data(as_text=True)+ return r.get_json()["total_value"]++ global_before = _global_total()++ # No currency on the form: the create fallback stores the user's RSD.+ r = warranty_factory(h, purchase_price="100")+ assert r.status_code in (200, 201), r.get_data(as_text=True)+ assert _stored_currency(db_connection, r.get_json()["id"]) == "RSD"+ # Explicit RSD row.+ warranty_factory(h, purchase_price="200", currency="RSD")+ # Legacy NULL-currency row: counts as the user's currency (#192 rule).+ r = warranty_factory(h, purchase_price="150", currency="USD")+ with db_connection, db_connection.cursor() as cur:+ cur.execute("UPDATE warranties SET currency = NULL WHERE id = %s",+ (r.get_json()["id"],))+ # Foreign-currency row: excluded.+ warranty_factory(h, purchase_price="500", currency="USD")++ r = client.get("/api/statistics", headers=h)+ assert r.status_code == 200, r.get_data(as_text=True)+ assert r.get_json()["total_value"] == 450 # 100 + 200 + 150, not the USD 500++ # Global path resolves the same user's default the same way.+ assert _global_total() - global_before == 450+++def test_csv_import_without_currency_column_stores_rsd(client, user_factory,+ db_connection):+ user = user_factory()+ h = user["headers"]+ _set_currency_symbol(db_connection, user["username"], "дин")++ csv_body = (+ "ProductName,PurchaseDate,IsLifetime,WarrantyDurationYears,"+ "WarrantyDurationMonths,WarrantyDurationDays,ExpirationDate,"+ "Status,PurchasePrice,SerialNumber,ProductURL,Tags,Vendor\n"+ '"RsdImportWidget",2025-01-01,FALSE,1,0,0,,,"1200",,,,,Acme\n'+ )+ r = client.post("/api/warranties/import", headers=h,+ data={"csv_file": (io.BytesIO(csv_body.encode()), "t.csv")},+ content_type="multipart/form-data")+ assert r.status_code == 200, r.get_data(as_text=True)++ with db_connection, db_connection.cursor() as cur:+ cur.execute("SELECT currency FROM warranties WHERE product_name = %s",+ ("RsdImportWidget",))+ row = cur.fetchone()+ assert row is not None+ assert row[0] == "RSD"