From 3a2d46ff720c35b51e21aedaa22357d71bd120e1 Mon Sep 17 00:00:00 2001 From: Lukas <76838159+wolflu05@users.noreply.github.com> Date: Fri, 19 Jul 2024 23:29:05 +0200 Subject: [PATCH] fix: tests --- .../barcodes/test_inventree_barcode.py | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/backend/InvenTree/plugin/builtin/barcodes/test_inventree_barcode.py b/src/backend/InvenTree/plugin/builtin/barcodes/test_inventree_barcode.py index aab979d2db..053baeaa76 100644 --- a/src/backend/InvenTree/plugin/builtin/barcodes/test_inventree_barcode.py +++ b/src/backend/InvenTree/plugin/builtin/barcodes/test_inventree_barcode.py @@ -340,14 +340,13 @@ class TestInvenTreeBarcode(InvenTreeAPITestCase): self.assertEqual(response.data['part']['pk'], 5) # Scan a SupplierPart instance with custom prefix - for prefix in ['TEST', '']: - self.set_plugin_setting('SHORT_BARCODE_PREFIX', prefix) - response = self.scan({'barcode': f'{prefix}SP1'}, expected_code=200) - self.assertEqual(response.data['supplierpart']['pk'], 1) - self.assertEqual(response.data['plugin'], 'InvenTreeBarcode') - self.assertIn('success', response.data) - self.assertIn('barcode_data', response.data) - self.assertIn('barcode_hash', response.data) + self.set_plugin_setting('SHORT_BARCODE_PREFIX', 'TEST') + response = self.scan({'barcode': 'TESTSP1'}, expected_code=200) + self.assertEqual(response.data['supplierpart']['pk'], 1) + self.assertEqual(response.data['plugin'], 'InvenTreeBarcode') + self.assertIn('success', response.data) + self.assertIn('barcode_data', response.data) + self.assertIn('barcode_hash', response.data) self.set_plugin_setting('SHORT_BARCODE_PREFIX', 'INV-') @@ -368,10 +367,9 @@ class TestInvenTreeBarcode(InvenTreeAPITestCase): self.assertEqual(data['barcode'], 'INV-SL5') # test generation with custom prefix - for prefix in ['TEST', '']: - self.set_plugin_setting('SHORT_BARCODE_PREFIX', prefix) - data = self.generate('stocklocation', item.pk, expected_code=200).data - self.assertEqual(data['barcode'], f'{prefix}SL5') + self.set_plugin_setting('SHORT_BARCODE_PREFIX', 'TEST') + data = self.generate('stocklocation', item.pk, expected_code=200).data + self.assertEqual(data['barcode'], 'TESTSL5') self.set_plugin_setting('SHORT_BARCODE_PREFIX', 'INV-') self.set_plugin_setting('INTERNAL_BARCODE_FORMAT', 'json')