From a7a24306943f8bb2d31f493bafc0b3ea4db9f619 Mon Sep 17 00:00:00 2001 From: sriram Date: Tue, 18 Aug 2026 18:42:28 +0530 Subject: [PATCH] backend changes on test files of catalog --- data/seed_catalogs/brand_catalog_bikaji.json | 47 ++++++++++++++++++++ data/sku_sequences/Aachi.json | 3 +- data/sku_sequences/Bikaji.json | 5 +++ data/sku_sequences/Idhayam.json | 5 +++ data/sku_sequences/amul.json | 5 +++ data/sku_sequences/britannia.json | 8 ++-- data/sku_sequences/cadbury.json | 2 +- data/sku_sequences/itc.json | 5 +++ data/sku_sequences/nestle.json | 7 +++ data/sku_sequences/parle.json | 5 +++ tests/test_store_catalog_pipeline.py | 13 ++++++ 11 files changed, 98 insertions(+), 7 deletions(-) create mode 100644 data/seed_catalogs/brand_catalog_bikaji.json create mode 100644 data/sku_sequences/Bikaji.json create mode 100644 data/sku_sequences/Idhayam.json create mode 100644 data/sku_sequences/amul.json create mode 100644 data/sku_sequences/itc.json create mode 100644 data/sku_sequences/nestle.json create mode 100644 data/sku_sequences/parle.json diff --git a/data/seed_catalogs/brand_catalog_bikaji.json b/data/seed_catalogs/brand_catalog_bikaji.json new file mode 100644 index 0000000..51244dc --- /dev/null +++ b/data/seed_catalogs/brand_catalog_bikaji.json @@ -0,0 +1,47 @@ +{ + "brand": "bikaji", + "search_query": "Bikaji products catalog", + "generation_timestamp": "C:\\Brand_Catalog_LLM\\RAG_Model_Nutrition_Intelligence\\RAG_Model_Full_Implement\\backend\\app\\services\\brand_sync.py", + "total_products": 1, + "total_images": 10, + "products": [ + { + "brand": "Bikaji", + "brand_name": "Bikaji", + "product_name": "Bikaji Aloo Bhujia 200g", + "title": "Bikaji Aloo", + "description": "Spiced potato snack", + "category": "Namkeen", + "image_id": "bikaji_bikaji_aloo_bhujia_200g", + "image_url": "https://m.media-amazon.com/images/I/81XXOOc0nlL._SL1500_.jpg", + "image_urls": [ + "https://m.media-amazon.com/images/I/81XXOOc0nlL._SL1500_.jpg", + "https://images.openfoodfacts.org/images/products/890/400/440/0731/front_en.4.400.jpg", + "https://images.openfoodfacts.org/images/products/890/400/440/0779/front_fr.9.400.jpg", + "https://images.openfoodfacts.org/images/products/890/400/440/0694/front_en.4.400.jpg", + "https://images.openfoodfacts.org/images/products/890/400/440/0687/front_en.5.400.jpg", + "https://images.openfoodfacts.org/images/products/890/400/440/0755/front_fr.3.400.jpg", + "https://images.openfoodfacts.org/images/products/890/406/324/0187/front_en.12.400.jpg", + "https://images.openfoodfacts.org/images/products/890/406/324/0057/front_en.16.400.jpg", + "https://images.openfoodfacts.org/images/products/890/406/320/0013/front_en.35.400.jpg", + "https://images.openfoodfacts.org/images/products/890/406/323/1574/front_en.3.400.jpg" + ], + "price_range": "₹27-33", + "size_variants": [ + "200g" + ], + "providers": [], + "fssai_license": "", + "product_sku": "BIKAJI-ALO-200-001", + "sku_source": "Internal", + "hsn_code": "1905", + "final_selling_price": 38.94, + "selling_price": 33.0, + "barcode": null, + "barcode_type": null, + "highlights": [], + "nutrients": [], + "search_query": "Bikaji Bikaji Aloo Bhujia 200g Namkeen Spiced potato snack" + } + ] +} \ No newline at end of file diff --git a/data/sku_sequences/Aachi.json b/data/sku_sequences/Aachi.json index 2b7b086..afe5120 100644 --- a/data/sku_sequences/Aachi.json +++ b/data/sku_sequences/Aachi.json @@ -1,5 +1,6 @@ { "_sku_sequences": { - "AACHI-SAM-100": 1 + "AACHI-SAM-100": 1, + "AACHI-SAM-200": 1 } } \ No newline at end of file diff --git a/data/sku_sequences/Bikaji.json b/data/sku_sequences/Bikaji.json new file mode 100644 index 0000000..feadee5 --- /dev/null +++ b/data/sku_sequences/Bikaji.json @@ -0,0 +1,5 @@ +{ + "_sku_sequences": { + "BIKAJI-ALO-200": 1 + } +} \ No newline at end of file diff --git a/data/sku_sequences/Idhayam.json b/data/sku_sequences/Idhayam.json new file mode 100644 index 0000000..e8e9b1f --- /dev/null +++ b/data/sku_sequences/Idhayam.json @@ -0,0 +1,5 @@ +{ + "_sku_sequences": { + "IDHAYA-SES-500": 1 + } +} \ No newline at end of file diff --git a/data/sku_sequences/amul.json b/data/sku_sequences/amul.json new file mode 100644 index 0000000..46915db --- /dev/null +++ b/data/sku_sequences/amul.json @@ -0,0 +1,5 @@ +{ + "_sku_sequences": { + "AMUL-BUT-500": 1 + } +} \ No newline at end of file diff --git a/data/sku_sequences/britannia.json b/data/sku_sequences/britannia.json index 21aeda8..151ce75 100644 --- a/data/sku_sequences/britannia.json +++ b/data/sku_sequences/britannia.json @@ -1,9 +1,7 @@ { "_sku_sequences": { - "BRITAN-50-200": 11, - "BRITAN-50-100": 4, - "BRITAN-50-250": 2, - "BRITAN-50-500": 3, - "BRITAN-GOO-200": 3 + "BRITAN-GOO-100": 1, + "BRITAN-GOO-200": 1, + "BRITAN-GOO-500": 1 } } \ No newline at end of file diff --git a/data/sku_sequences/cadbury.json b/data/sku_sequences/cadbury.json index c3085d0..4e2a4fb 100644 --- a/data/sku_sequences/cadbury.json +++ b/data/sku_sequences/cadbury.json @@ -1,5 +1,5 @@ { "_sku_sequences": { - "CADBUR-DAI-100": 1 + "CADBUR-DAI-150": 1 } } \ No newline at end of file diff --git a/data/sku_sequences/itc.json b/data/sku_sequences/itc.json new file mode 100644 index 0000000..627a2f0 --- /dev/null +++ b/data/sku_sequences/itc.json @@ -0,0 +1,5 @@ +{ + "_sku_sequences": { + "ITC-AAS-1": 1 + } +} \ No newline at end of file diff --git a/data/sku_sequences/nestle.json b/data/sku_sequences/nestle.json new file mode 100644 index 0000000..31880ca --- /dev/null +++ b/data/sku_sequences/nestle.json @@ -0,0 +1,7 @@ +{ + "_sku_sequences": { + "NESTLE-MUN-20": 1, + "NESTLE-MUN-55": 1, + "NESTLE-MUN-150": 1 + } +} \ No newline at end of file diff --git a/data/sku_sequences/parle.json b/data/sku_sequences/parle.json new file mode 100644 index 0000000..9e169cd --- /dev/null +++ b/data/sku_sequences/parle.json @@ -0,0 +1,5 @@ +{ + "_sku_sequences": { + "PARLE-G-250": 1 + } +} \ No newline at end of file diff --git a/tests/test_store_catalog_pipeline.py b/tests/test_store_catalog_pipeline.py index 801c196..520feef 100644 --- a/tests/test_store_catalog_pipeline.py +++ b/tests/test_store_catalog_pipeline.py @@ -30,6 +30,19 @@ def _sheet(headers, rows) -> bytes: return buf.getvalue() +@pytest.fixture(autouse=True) +def _isolate_sku_counter(tmp_path, monkeypatch): + """Keep the SKU sequence counter out of the repo. + + `sku_service` persists its per-brand counter to DATA_DIR/sku_sequences so + reruns keep issuing fresh numbers. Left alone, running the suite mutates a + real directory in the working tree; pointing it at tmp_path keeps each test + session self-contained and makes SKU numbering deterministic per test. + """ + from app.services import sku_service + monkeypatch.setattr(sku_service, "_data_dir", tmp_path / "sku_sequences") + + @pytest.fixture def store(monkeypatch): """A fake brand table. Returns the dict of image_id -> stored row."""