rename availability policies
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
j3d1 2024-02-23 18:51:52 +01:00
parent f4894d3a8c
commit 52dbe93d3c
3 changed files with 6 additions and 4 deletions

View file

@ -196,6 +196,8 @@ def main():
reset() reset()
elif args.cmd == 'testdata': elif args.cmd == 'testdata':
testdata() testdata()
elif args.cmd == 'migrate':
print('not implemented yet')
else: else:
print('Unknown command: {}'.format(args.cmd)) print('Unknown command: {}'.format(args.cmd))
exit(1) exit(1)

View file

@ -5,7 +5,7 @@ from rest_framework.response import Response
from hostadmin.models import Domain from hostadmin.models import Domain
from authentication.signature_auth import SignatureAuthentication from authentication.signature_auth import SignatureAuthentication
from toolshed.models import Tag, Property, Category from toolshed.models import Tag, Property, Category, InventoryItem
from toolshed.serializers import CategorySerializer, PropertySerializer from toolshed.serializers import CategorySerializer, PropertySerializer
from backend.settings import TOOLSHED_VERSION from backend.settings import TOOLSHED_VERSION
@ -51,8 +51,7 @@ def list_categories(request, format=None): # /categories/
@permission_classes([IsAuthenticated]) @permission_classes([IsAuthenticated])
@authentication_classes([SignatureAuthentication]) @authentication_classes([SignatureAuthentication])
def list_availability_policies(request, format=None): # /availability_policies/ def list_availability_policies(request, format=None): # /availability_policies/
policies = ['private', 'friends', 'internal', 'public'] return Response(InventoryItem.AVAILABILITY_POLICY_CHOICES)
return Response(policies)
@api_view(['GET']) @api_view(['GET'])

View file

@ -43,7 +43,8 @@ class CombinedApiTestCase(UserTestMixin, CategoryTestMixin, TagTestMixin, Proper
def test_policy_api(self): def test_policy_api(self):
response = client.get('/api/availability_policies/', self.f['local_user1']) response = client.get('/api/availability_policies/', self.f['local_user1'])
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), ['private', 'friends', 'internal', 'public']) self.assertEqual(response.json(), [['sell', 'Sell'], ['rent', 'Rent'], ['lend', 'Lend'], ['share', 'Share'],
['private', 'Private']])
def test_combined_api_anonymous(self): def test_combined_api_anonymous(self):
response = anonymous_client.get('/api/info/') response = anonymous_client.get('/api/info/')