Add some more unit tests

This commit is contained in:
Oliver 2021-10-16 13:16:19 +11:00
parent 41e59e5311
commit b60296e494

View File

@ -203,6 +203,23 @@ class PurchaseOrderTest(OrderTest):
# And if we try to access the detail view again, it has gone
response = self.get(url, expected_code=404)
def test_po_create(self):
"""
Test that we can create a new PurchaseOrder via the API
"""
self.assignRole('purchase_order.add')
self.post(
reverse('api-po-list'),
{
'reference': '12345678',
'supplier': 1,
'description': 'A test purchase order',
},
expected_code=201
)
class PurchaseOrderReceiveTest(OrderTest):
"""
@ -607,3 +624,20 @@ class SalesOrderTest(OrderTest):
# And the resource should no longer be available
response = self.get(url, expected_code=404)
def test_so_create(self):
"""
Test that we can create a new SalesOrder via the API
"""
self.assignRole('sales_order.add')
self.post(
reverse('api-so-list'),
{
'reference': '1234566778',
'customer': 4,
'description': 'A test sales order',
},
expected_code=201
)