From bd2b279390a4682d479546555890391f87655134 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 13 Mar 2022 19:38:57 +0100 Subject: [PATCH] add coverage to barcode api --- InvenTree/barcodes/tests.py | 9 +++++++++ InvenTree/stock/fixtures/stock.yaml | 1 + 2 files changed, 10 insertions(+) diff --git a/InvenTree/barcodes/tests.py b/InvenTree/barcodes/tests.py index 4df62fe4f8..1f43d4aca3 100644 --- a/InvenTree/barcodes/tests.py +++ b/InvenTree/barcodes/tests.py @@ -259,3 +259,12 @@ class TestInvenTreeBarcode(APITestCase): # test with hash test_assert_error('{"blbla": 10004}') + + def test_scan(self): + """ + Test that a barcode can be scanned + """ + + response = self.client.post(reverse('api-barcode-scan'), format='json', data={'barcode': 'blbla=10004',}) + self.assertEqual(response.status_code, status.HTTP_200_OK) + self.assertIn('success', response.data) diff --git a/InvenTree/stock/fixtures/stock.yaml b/InvenTree/stock/fixtures/stock.yaml index f1926be478..0f44828d8e 100644 --- a/InvenTree/stock/fixtures/stock.yaml +++ b/InvenTree/stock/fixtures/stock.yaml @@ -222,6 +222,7 @@ lft: 0 rght: 0 expiry_date: "1990-10-10" + uid: 9e5ae7fc20568ed4814c10967bba8b65 - model: stock.stockitem pk: 521