diff --git a/.gitignore b/.gitignore index 0307806..af8941b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ tmp/ db/ venv .env -.vscode \ No newline at end of file +.vscode +.pytest_cache \ No newline at end of file diff --git a/copanier/static/app.css b/copanier/static/app.css index 7047838..db59a77 100644 --- a/copanier/static/app.css +++ b/copanier/static/app.css @@ -423,9 +423,7 @@ hr { text-align: center; padding: 5px; } -.carrelage li input { - /*max-width: 80%;*/ -} + .carrelage li img { width: 50%; } diff --git a/tests/test_imports.py b/tests/test_imports.py index 8942db8..e6ecd0e 100644 --- a/tests/test_imports.py +++ b/tests/test_imports.py @@ -22,7 +22,7 @@ def workbook(): def test_mandatory_headers_with_xlsx(delivery, workbook): with pytest.raises(ValueError): - imports.products_from_xlsx( + imports.products_and_producers_from_xlsx( delivery, workbook([("123", "Chocolat", "2.3")], headers=["ref", "nom", "prix"]), ) @@ -30,13 +30,15 @@ def test_mandatory_headers_with_xlsx(delivery, workbook): def test_bad_xlsx_file(delivery, workbook): with pytest.raises(ValueError): - imports.products_from_xlsx(delivery, BytesIO(b"pouet")) + imports.products_and_producers_from_xlsx(delivery, BytesIO(b"pouet")) def test_simple_xlsx_import(delivery, workbook): delivery.persist() assert delivery.products == [Product(ref="123", name="Lait", price=1.5)] - imports.products_from_xlsx(delivery, workbook([("123", "Lait cru", 1.3)])) + imports.products_and_producers_from_xlsx( + delivery, workbook([("123", "Lait cru", 1.3)]) + ) assert Delivery.load(delivery.id).products == [ Product(ref="123", name="Lait cru", price=1.3) ] @@ -46,36 +48,9 @@ def test_simple_xlsx_import_invalid_price(delivery, workbook): delivery.persist() assert delivery.products == [Product(ref="123", name="Lait", price=1.5)] with pytest.raises(ValueError): - imports.products_from_xlsx(delivery, workbook([("123", "Lait cru", "invalid")])) - assert Delivery.load(delivery.id).products == [ - Product(ref="123", name="Lait", price=1.5) - ] - - -def test_mandatory_headers_with_csv(delivery): - with pytest.raises(ValueError): - imports.products_from_csv(delivery, "ref;nom;prix\n123;Chocolat;2.3") - - -def test_bad_csv_file(delivery): - with pytest.raises(ValueError): - imports.products_from_csv(delivery, "pouet") - - -def test_simple_csv_import(delivery): - delivery.persist() - assert delivery.products == [Product(ref="123", name="Lait", price=1.5)] - imports.products_from_csv(delivery, "ref;name;price\n123;Lait cru;1.3") - assert Delivery.load(delivery.id).products == [ - Product(ref="123", name="Lait cru", price=1.3) - ] - - -def test_simple_csv_import_invalid_price(delivery): - delivery.persist() - assert delivery.products == [Product(ref="123", name="Lait", price=1.5)] - with pytest.raises(ValueError): - imports.products_from_csv(delivery, "ref;name;price\n123;Lait cru;invalid") + imports.products_and_producers_from_xlsx( + delivery, workbook([("123", "Lait cru", "invalid")]) + ) assert Delivery.load(delivery.id).products == [ Product(ref="123", name="Lait", price=1.5) ]