mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Bump djangorestframework from 3.14.0 to 3.15.2 in /src/backend (#7520)
* Bump djangorestframework from 3.14.0 to 3.15.2 in /src/backend Bumps [djangorestframework](https://github.com/encode/django-rest-framework) from 3.14.0 to 3.15.2. - [Release notes](https://github.com/encode/django-rest-framework/releases) - [Commits](https://github.com/encode/django-rest-framework/compare/3.14.0...3.15.2) --- updated-dependencies: - dependency-name: djangorestframework dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * fix req * fix deps again * patch serializer * bump api version * Fix "min_value" for DRF decimal fields * Add default serializer values for 'IPN' and 'revision' * Add specific serializer for email field * Bump API version * code cleanup * fix tests * allow null for email too * fix formatting --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Matthias Mair <code@mjmair.com> Co-authored-by: Oliver Walters <oliver.henry.walters@gmail.com>
This commit is contained in:
parent
8474b7bf4c
commit
0c63e509d2
@ -1,13 +1,16 @@
|
|||||||
"""InvenTree API version information."""
|
"""InvenTree API version information."""
|
||||||
|
|
||||||
# InvenTree API version
|
# InvenTree API version
|
||||||
INVENTREE_API_VERSION = 244
|
INVENTREE_API_VERSION = 245
|
||||||
|
|
||||||
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
|
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
|
||||||
|
|
||||||
|
|
||||||
INVENTREE_API_TEXT = """
|
INVENTREE_API_TEXT = """
|
||||||
|
|
||||||
|
v245 - 2024-08-21 : https://github.com/inventree/InvenTree/pull/7520
|
||||||
|
- Documented pagination fields (no functional changes)
|
||||||
|
|
||||||
v244 - 2024-08-21 : https://github.com/inventree/InvenTree/pull/7941
|
v244 - 2024-08-21 : https://github.com/inventree/InvenTree/pull/7941
|
||||||
- Adds "create_child_builds" field to the Build API
|
- Adds "create_child_builds" field to the Build API
|
||||||
- Write-only field to create child builds from the API
|
- Write-only field to create child builds from the API
|
||||||
|
@ -92,9 +92,7 @@ class APITests(InvenTreeAPITestCase):
|
|||||||
"""Test token resolve endpoint does not work without basic auth."""
|
"""Test token resolve endpoint does not work without basic auth."""
|
||||||
# Test token endpoint without basic auth
|
# Test token endpoint without basic auth
|
||||||
url = reverse('api-token')
|
url = reverse('api-token')
|
||||||
response = self.client.get(url, format='json')
|
self.get(url, expected_code=401)
|
||||||
|
|
||||||
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
|
|
||||||
self.assertIsNone(self.token)
|
self.assertIsNone(self.token)
|
||||||
|
|
||||||
def test_token_success(self):
|
def test_token_success(self):
|
||||||
@ -106,7 +104,7 @@ class APITests(InvenTreeAPITestCase):
|
|||||||
"""Test that we can read the 'info-view' endpoint."""
|
"""Test that we can read the 'info-view' endpoint."""
|
||||||
url = reverse('api-inventree-info')
|
url = reverse('api-inventree-info')
|
||||||
|
|
||||||
response = self.client.get(url, format='json')
|
response = self.get(url)
|
||||||
|
|
||||||
data = response.json()
|
data = response.json()
|
||||||
self.assertIn('server', data)
|
self.assertIn('server', data)
|
||||||
@ -126,7 +124,7 @@ class APITests(InvenTreeAPITestCase):
|
|||||||
self.group.rule_sets.all().delete()
|
self.group.rule_sets.all().delete()
|
||||||
update_group_roles(self.group)
|
update_group_roles(self.group)
|
||||||
|
|
||||||
response = self.client.get(url, format='json')
|
response = self.get(url, expected_code=401)
|
||||||
|
|
||||||
# Not logged in, so cannot access user role data
|
# Not logged in, so cannot access user role data
|
||||||
self.assertIn(response.status_code, [401, 403])
|
self.assertIn(response.status_code, [401, 403])
|
||||||
|
@ -13,12 +13,12 @@ class ApiVersionTests(InvenTreeAPITestCase):
|
|||||||
def test_api(self):
|
def test_api(self):
|
||||||
"""Test that the API text is correct."""
|
"""Test that the API text is correct."""
|
||||||
url = reverse('api-version-text')
|
url = reverse('api-version-text')
|
||||||
response = self.client.get(url, format='json')
|
response = self.get(url, format='json')
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
|
||||||
self.assertEqual(len(data), 10)
|
self.assertEqual(len(data), 10)
|
||||||
|
|
||||||
response = self.client.get(reverse('api-version'), format='json').json()
|
response = self.get(reverse('api-version')).json()
|
||||||
self.assertIn('version', response)
|
self.assertIn('version', response)
|
||||||
self.assertIn('dev', response)
|
self.assertIn('dev', response)
|
||||||
self.assertIn('up_to_date', response)
|
self.assertIn('up_to_date', response)
|
||||||
|
@ -166,6 +166,10 @@ class CompanySerializer(
|
|||||||
|
|
||||||
image = InvenTreeImageSerializerField(required=False, allow_null=True)
|
image = InvenTreeImageSerializerField(required=False, allow_null=True)
|
||||||
|
|
||||||
|
email = serializers.EmailField(
|
||||||
|
required=False, default='', allow_blank=True, allow_null=True
|
||||||
|
)
|
||||||
|
|
||||||
parts_supplied = serializers.IntegerField(read_only=True)
|
parts_supplied = serializers.IntegerField(read_only=True)
|
||||||
parts_manufactured = serializers.IntegerField(read_only=True)
|
parts_manufactured = serializers.IntegerField(read_only=True)
|
||||||
address_count = serializers.IntegerField(read_only=True)
|
address_count = serializers.IntegerField(read_only=True)
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
from rest_framework import status
|
|
||||||
|
|
||||||
from InvenTree.unit_test import InvenTreeAPITestCase
|
from InvenTree.unit_test import InvenTreeAPITestCase
|
||||||
from part.models import Part
|
from part.models import Part
|
||||||
|
|
||||||
@ -394,8 +392,7 @@ class ManufacturerTest(InvenTreeAPITestCase):
|
|||||||
|
|
||||||
# Create manufacturer part
|
# Create manufacturer part
|
||||||
data = {'part': 1, 'manufacturer': 7, 'MPN': 'MPN_TEST'}
|
data = {'part': 1, 'manufacturer': 7, 'MPN': 'MPN_TEST'}
|
||||||
response = self.client.post(url, data, format='json')
|
response = self.post(url, data, expected_code=201)
|
||||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
|
||||||
self.assertEqual(response.data['MPN'], 'MPN_TEST')
|
self.assertEqual(response.data['MPN'], 'MPN_TEST')
|
||||||
|
|
||||||
# Filter by manufacturer
|
# Filter by manufacturer
|
||||||
@ -418,9 +415,7 @@ class ManufacturerTest(InvenTreeAPITestCase):
|
|||||||
# Change the MPN
|
# Change the MPN
|
||||||
data = {'MPN': 'MPN-TEST-123'}
|
data = {'MPN': 'MPN-TEST-123'}
|
||||||
|
|
||||||
response = self.client.patch(url, data, format='json')
|
response = self.patch(url, data)
|
||||||
|
|
||||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
|
||||||
self.assertEqual(response.data['MPN'], 'MPN-TEST-123')
|
self.assertEqual(response.data['MPN'], 'MPN-TEST-123')
|
||||||
|
|
||||||
def test_manufacturer_part_search(self):
|
def test_manufacturer_part_search(self):
|
||||||
@ -457,8 +452,7 @@ class ManufacturerTest(InvenTreeAPITestCase):
|
|||||||
'link': 'https://www.axel-larsson.se/Exego.aspx?p_id=341&ArtNr=0804020E',
|
'link': 'https://www.axel-larsson.se/Exego.aspx?p_id=341&ArtNr=0804020E',
|
||||||
}
|
}
|
||||||
|
|
||||||
response = self.client.post(url, data, format='json')
|
response = self.post(url, data)
|
||||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
|
||||||
|
|
||||||
# Check link is not modified
|
# Check link is not modified
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@ -348,6 +348,19 @@ class PartBriefSerializer(InvenTree.serializers.InvenTreeModelSerializer):
|
|||||||
image = InvenTree.serializers.InvenTreeImageSerializerField(read_only=True)
|
image = InvenTree.serializers.InvenTreeImageSerializerField(read_only=True)
|
||||||
thumbnail = serializers.CharField(source='get_thumbnail_url', read_only=True)
|
thumbnail = serializers.CharField(source='get_thumbnail_url', read_only=True)
|
||||||
|
|
||||||
|
IPN = serializers.CharField(
|
||||||
|
required=False,
|
||||||
|
allow_null=True,
|
||||||
|
help_text=_('Internal Part Number'),
|
||||||
|
max_length=100,
|
||||||
|
)
|
||||||
|
revision = serializers.CharField(
|
||||||
|
required=False,
|
||||||
|
allow_null=True,
|
||||||
|
help_text=_('Part revision or version number'),
|
||||||
|
max_length=100,
|
||||||
|
)
|
||||||
|
|
||||||
# Pricing fields
|
# Pricing fields
|
||||||
pricing_min = InvenTree.serializers.InvenTreeMoneySerializer(
|
pricing_min = InvenTree.serializers.InvenTreeMoneySerializer(
|
||||||
source='pricing_data.overall_min', allow_null=True, read_only=True
|
source='pricing_data.overall_min', allow_null=True, read_only=True
|
||||||
@ -891,6 +904,14 @@ class PartSerializer(
|
|||||||
queryset=users.models.User.objects.all(), required=False, allow_null=True
|
queryset=users.models.User.objects.all(), required=False, allow_null=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
IPN = serializers.CharField(
|
||||||
|
required=False, default='', allow_blank=True, label=_('IPN'), max_length=100
|
||||||
|
)
|
||||||
|
|
||||||
|
revision = serializers.CharField(
|
||||||
|
required=False, default='', allow_blank=True, max_length=100
|
||||||
|
)
|
||||||
|
|
||||||
# Annotated fields
|
# Annotated fields
|
||||||
allocated_to_build_orders = serializers.FloatField(read_only=True)
|
allocated_to_build_orders = serializers.FloatField(read_only=True)
|
||||||
allocated_to_sales_orders = serializers.FloatField(read_only=True)
|
allocated_to_sales_orders = serializers.FloatField(read_only=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user