2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 03:00:54 +00:00

Tests/stocklocation and partcategory (#3473)

* Added description to response field check

* Added more tests

* Update InvenTree/part/test_api.py
This commit is contained in:
luwol03
2022-08-05 02:58:01 +02:00
committed by GitHub
parent a9e22d0ae9
commit 26a85d5e95
2 changed files with 16 additions and 2 deletions

View File

@ -69,6 +69,9 @@ class StockLocationTest(StockAPITestCase):
({'parent': 1, 'cascade': False, 'depth': 1}, 2, 'Dont cascade even with depth=1 specified with parent'),
({'parent': 1, 'cascade': True, 'depth': 1}, 2, 'Cascade with depth=1 with parent'),
({'parent': 1, 'cascade': True, 'depth': 'abcdefg'}, 2, 'Cascade with invalid depth and parent'),
({'parent': 42}, 8, 'Should return everything if parent_pk is not vaild'),
({'parent': 'null', 'exclude_tree': 1, 'cascade': True}, 5, 'Should return everything except tree with pk=1'),
({'parent': 'null', 'exclude_tree': 42, 'cascade': True}, 8, 'Should return everything because exclude_tree=42 is no valid pk'),
]
for params, res_len, description in test_cases:
@ -91,7 +94,7 @@ class StockLocationTest(StockAPITestCase):
response = self.get(self.list_url, expected_code=200)
for result in response.data:
for f in fields:
self.assertIn(f, result)
self.assertIn(f, result, f'"{f}" is missing in result of StockLocation list')
def test_add(self):
"""Test adding StockLocation."""