unittests to show the fix works

This commit is contained in:
Matthias 2021-12-01 23:45:16 +01:00
parent 7c9201730a
commit fc6f1b4acc
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -105,6 +105,33 @@ class PurchaseOrderTest(OrderTest):
self.assertEqual(data['pk'], 1)
self.assertEqual(data['description'], 'Ordering some screws')
def test_po_reference(self):
"""test that a reference with a too big / small reference is not possible"""
url = reverse('api-po-list')
huge_numer = 9223372036854775808
# too big
self.post(
url,
{
'supplier': 1,
'reference': huge_numer,
'description': 'PO not created via the API',
},
expected_code=400
)
# too small
self.post(
url,
{
'supplier': 1,
'reference': -huge_numer,
'description': 'PO not created via the API',
},
expected_code=400
)
def test_po_attachments(self):
url = reverse('api-po-attachment-list')