mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-01 13:06:45 +00:00
Style fixes (#6203)
This commit is contained in:
parent
9d0264c319
commit
df8b480abb
@ -619,7 +619,7 @@ class PartSerializer(
|
|||||||
# These fields are only used for the LIST API endpoint
|
# These fields are only used for the LIST API endpoint
|
||||||
for f in self.skip_create_fields():
|
for f in self.skip_create_fields():
|
||||||
# Fields required for certain operations, but are not part of the model
|
# Fields required for certain operations, but are not part of the model
|
||||||
if f in ["remote_image", "existing_image"]:
|
if f in ['remote_image', 'existing_image']:
|
||||||
continue
|
continue
|
||||||
self.fields.pop(f)
|
self.fields.pop(f)
|
||||||
|
|
||||||
|
@ -1575,7 +1575,7 @@ class PartDetailTests(PartAPITestBase):
|
|||||||
self.assertEqual(response.data['image'], image_name)
|
self.assertEqual(response.data['image'], image_name)
|
||||||
|
|
||||||
def test_update_existing_image(self):
|
def test_update_existing_image(self):
|
||||||
"""Test that we can update the image of an existing part with an already existing image"""
|
"""Test that we can update the image of an existing part with an already existing image."""
|
||||||
# First, upload an image for an existing part
|
# First, upload an image for an existing part
|
||||||
p = Part.objects.first()
|
p = Part.objects.first()
|
||||||
|
|
||||||
@ -1587,10 +1587,7 @@ class PartDetailTests(PartAPITestBase):
|
|||||||
# Upload the image to a part
|
# Upload the image to a part
|
||||||
with open(fn, 'rb') as img_file:
|
with open(fn, 'rb') as img_file:
|
||||||
response = self.upload_client.patch(
|
response = self.upload_client.patch(
|
||||||
reverse('api-part-detail', kwargs={'pk': p.pk}),
|
reverse('api-part-detail', kwargs={'pk': p.pk}), {'image': img_file}
|
||||||
{
|
|
||||||
'image': img_file,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
@ -1603,9 +1600,9 @@ class PartDetailTests(PartAPITestBase):
|
|||||||
{
|
{
|
||||||
'name': 'Some New Part',
|
'name': 'Some New Part',
|
||||||
'description': 'Description of the part',
|
'description': 'Description of the part',
|
||||||
'category': 1
|
'category': 1,
|
||||||
},
|
},
|
||||||
expected_code=201
|
expected_code=201,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(response.data['image'], None)
|
self.assertEqual(response.data['image'], None)
|
||||||
@ -1614,10 +1611,8 @@ class PartDetailTests(PartAPITestBase):
|
|||||||
# Add image from the first part to the new part
|
# Add image from the first part to the new part
|
||||||
response = self.patch(
|
response = self.patch(
|
||||||
reverse('api-part-detail', kwargs={'pk': part_pk}),
|
reverse('api-part-detail', kwargs={'pk': part_pk}),
|
||||||
{
|
{'existing_image': image_name},
|
||||||
'existing_image': image_name
|
expected_code=200,
|
||||||
},
|
|
||||||
expected_code=200
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(response.data['image'], image_name)
|
self.assertEqual(response.data['image'], image_name)
|
||||||
@ -1626,10 +1621,8 @@ class PartDetailTests(PartAPITestBase):
|
|||||||
last_p = Part.objects.last()
|
last_p = Part.objects.last()
|
||||||
response = self.patch(
|
response = self.patch(
|
||||||
reverse('api-part-detail', kwargs={'pk': last_p.pk}),
|
reverse('api-part-detail', kwargs={'pk': last_p.pk}),
|
||||||
{
|
{'existing_image': 'bogus_image.jpg'},
|
||||||
'existing_image': 'bogus_image.jpg'
|
expected_code=400,
|
||||||
},
|
|
||||||
expected_code=400
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_details(self):
|
def test_details(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user