fix inconsistencies between policy api ant combined info api
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
b3bae6f5ad
commit
f2db5d9dad
4 changed files with 8 additions and 4 deletions
2
backend/.idea/.gitignore
vendored
2
backend/.idea/.gitignore
vendored
|
@ -6,3 +6,5 @@
|
||||||
# Datasource local storage ignored files
|
# Datasource local storage ignored files
|
||||||
/dataSources/
|
/dataSources/
|
||||||
/dataSources.local.xml
|
/dataSources.local.xml
|
||||||
|
# GitHub Copilot persisted chat sessions
|
||||||
|
/copilot/chatSessions
|
||||||
|
|
|
@ -61,9 +61,11 @@ def combined_info(request, format=None): # /info/
|
||||||
tags = [tag.name for tag in Tag.objects.all()]
|
tags = [tag.name for tag in Tag.objects.all()]
|
||||||
properties = PropertySerializer(Property.objects.all(), many=True).data
|
properties = PropertySerializer(Property.objects.all(), many=True).data
|
||||||
categories = [str(category) for category in Category.objects.all()]
|
categories = [str(category) for category in Category.objects.all()]
|
||||||
policies = ['private', 'friends', 'internal', 'public']
|
policies = InventoryItem.AVAILABILITY_POLICY_CHOICES
|
||||||
domains = [domain.name for domain in Domain.objects.filter(open_registration=True)]
|
domains = [domain.name for domain in Domain.objects.filter(open_registration=True)]
|
||||||
return Response({'tags': tags, 'properties': properties, 'availability_policies': policies, 'categories': categories, 'domains': domains})
|
return Response(
|
||||||
|
{'tags': tags, 'properties': properties, 'availability_policies': policies, 'categories': categories,
|
||||||
|
'domains': domains})
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
|
|
@ -53,7 +53,8 @@ class CombinedApiTestCase(UserTestMixin, CategoryTestMixin, TagTestMixin, Proper
|
||||||
def test_combined_api(self):
|
def test_combined_api(self):
|
||||||
response = client.get('/api/info/', self.f['local_user1'])
|
response = client.get('/api/info/', self.f['local_user1'])
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertEqual(response.json()['availability_policies'], ['private', 'friends', 'internal', 'public'])
|
self.assertEqual(response.json()['availability_policies'], [['sell', 'Sell'], ['rent', 'Rent'], ['lend', 'Lend'],
|
||||||
|
['share', 'Share'], ['private', 'Private']])
|
||||||
self.assertEqual(response.json()['categories'],
|
self.assertEqual(response.json()['categories'],
|
||||||
['cat1', 'cat2', 'cat3', 'cat1/subcat1', 'cat1/subcat2', 'cat1/subcat1/subcat3'])
|
['cat1', 'cat2', 'cat3', 'cat1/subcat1', 'cat1/subcat2', 'cat1/subcat1/subcat3'])
|
||||||
self.assertEqual(response.json()['tags'], ['tag1', 'tag2', 'tag3'])
|
self.assertEqual(response.json()['tags'], ['tag1', 'tag2', 'tag3'])
|
||||||
|
|
|
@ -375,7 +375,6 @@ class FriendRequestCombinedTestCase(UserTestMixin, ToolshedTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.prepare_users()
|
self.prepare_users()
|
||||||
print(self.f)
|
|
||||||
|
|
||||||
def test_friend_request_combined(self):
|
def test_friend_request_combined(self):
|
||||||
befriender = self.f['local_user1']
|
befriender = self.f['local_user1']
|
||||||
|
|
Loading…
Reference in a new issue