mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Scheduling api fix (#5093)
* Fix query for part scheduling API * Add unit test for scheduling endpoint * Remove length check
This commit is contained in:
parent
603aef5da9
commit
fab738cd75
@ -597,8 +597,8 @@ class PartScheduling(RetrieveAPI):
|
||||
|
||||
# Grab all allocations against the specified BomItem
|
||||
allocations = BuildItem.objects.filter(
|
||||
bom_item=bom_item,
|
||||
build=build,
|
||||
build_line__bom_item=bom_item,
|
||||
build_line__build=build,
|
||||
)
|
||||
|
||||
# Total allocated for *this* part
|
||||
|
@ -536,6 +536,7 @@ class PartAPITestBase(InvenTreeAPITestCase):
|
||||
'part',
|
||||
'location',
|
||||
'bom',
|
||||
'build',
|
||||
'company',
|
||||
'test_templates',
|
||||
'manufacturer_part',
|
||||
@ -3056,3 +3057,22 @@ class PartMetadataAPITest(InvenTreeAPITestCase):
|
||||
'api-bom-item-metadata': BomItem,
|
||||
}.items():
|
||||
self.metatester(apikey, model)
|
||||
|
||||
|
||||
class PartSchedulingTest(PartAPITestBase):
|
||||
"""Unit tests for the 'part scheduling' API endpoint"""
|
||||
|
||||
def test_get_schedule(self):
|
||||
"""Test that the scheduling endpoint returns OK"""
|
||||
|
||||
part_ids = [
|
||||
1, 3, 100, 101,
|
||||
]
|
||||
|
||||
for pk in part_ids:
|
||||
url = reverse('api-part-scheduling', kwargs={'pk': pk})
|
||||
data = self.get(url, expected_code=200).data
|
||||
|
||||
for entry in data:
|
||||
for k in ['date', 'quantity', 'label']:
|
||||
self.assertIn(k, entry)
|
||||
|
Loading…
Reference in New Issue
Block a user