mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-14 02:55:41 +00:00
fix: tests
This commit is contained in:
@ -340,14 +340,13 @@ class TestInvenTreeBarcode(InvenTreeAPITestCase):
|
|||||||
self.assertEqual(response.data['part']['pk'], 5)
|
self.assertEqual(response.data['part']['pk'], 5)
|
||||||
|
|
||||||
# Scan a SupplierPart instance with custom prefix
|
# Scan a SupplierPart instance with custom prefix
|
||||||
for prefix in ['TEST', '']:
|
self.set_plugin_setting('SHORT_BARCODE_PREFIX', 'TEST')
|
||||||
self.set_plugin_setting('SHORT_BARCODE_PREFIX', prefix)
|
response = self.scan({'barcode': 'TESTSP1'}, expected_code=200)
|
||||||
response = self.scan({'barcode': f'{prefix}SP1'}, expected_code=200)
|
self.assertEqual(response.data['supplierpart']['pk'], 1)
|
||||||
self.assertEqual(response.data['supplierpart']['pk'], 1)
|
self.assertEqual(response.data['plugin'], 'InvenTreeBarcode')
|
||||||
self.assertEqual(response.data['plugin'], 'InvenTreeBarcode')
|
self.assertIn('success', response.data)
|
||||||
self.assertIn('success', response.data)
|
self.assertIn('barcode_data', response.data)
|
||||||
self.assertIn('barcode_data', response.data)
|
self.assertIn('barcode_hash', response.data)
|
||||||
self.assertIn('barcode_hash', response.data)
|
|
||||||
|
|
||||||
self.set_plugin_setting('SHORT_BARCODE_PREFIX', 'INV-')
|
self.set_plugin_setting('SHORT_BARCODE_PREFIX', 'INV-')
|
||||||
|
|
||||||
@ -368,10 +367,9 @@ class TestInvenTreeBarcode(InvenTreeAPITestCase):
|
|||||||
self.assertEqual(data['barcode'], 'INV-SL5')
|
self.assertEqual(data['barcode'], 'INV-SL5')
|
||||||
|
|
||||||
# test generation with custom prefix
|
# test generation with custom prefix
|
||||||
for prefix in ['TEST', '']:
|
self.set_plugin_setting('SHORT_BARCODE_PREFIX', 'TEST')
|
||||||
self.set_plugin_setting('SHORT_BARCODE_PREFIX', prefix)
|
data = self.generate('stocklocation', item.pk, expected_code=200).data
|
||||||
data = self.generate('stocklocation', item.pk, expected_code=200).data
|
self.assertEqual(data['barcode'], 'TESTSL5')
|
||||||
self.assertEqual(data['barcode'], f'{prefix}SL5')
|
|
||||||
|
|
||||||
self.set_plugin_setting('SHORT_BARCODE_PREFIX', 'INV-')
|
self.set_plugin_setting('SHORT_BARCODE_PREFIX', 'INV-')
|
||||||
self.set_plugin_setting('INTERNAL_BARCODE_FORMAT', 'json')
|
self.set_plugin_setting('INTERNAL_BARCODE_FORMAT', 'json')
|
||||||
|
Reference in New Issue
Block a user