diff --git a/backend/.idea/.gitignore b/backend/.idea/.gitignore index 13566b8..a9d7db9 100644 --- a/backend/.idea/.gitignore +++ b/backend/.idea/.gitignore @@ -6,3 +6,5 @@ # Datasource local storage ignored files /dataSources/ /dataSources.local.xml +# GitHub Copilot persisted chat sessions +/copilot/chatSessions diff --git a/backend/toolshed/api/info.py b/backend/toolshed/api/info.py index 3c54412..7395c03 100644 --- a/backend/toolshed/api/info.py +++ b/backend/toolshed/api/info.py @@ -61,9 +61,11 @@ def combined_info(request, format=None): # /info/ tags = [tag.name for tag in Tag.objects.all()] properties = PropertySerializer(Property.objects.all(), many=True).data 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)] - 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 = [ diff --git a/backend/toolshed/tests/test_api.py b/backend/toolshed/tests/test_api.py index c926dec..716b670 100644 --- a/backend/toolshed/tests/test_api.py +++ b/backend/toolshed/tests/test_api.py @@ -53,7 +53,8 @@ class CombinedApiTestCase(UserTestMixin, CategoryTestMixin, TagTestMixin, Proper def test_combined_api(self): response = client.get('/api/info/', self.f['local_user1']) 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'], ['cat1', 'cat2', 'cat3', 'cat1/subcat1', 'cat1/subcat2', 'cat1/subcat1/subcat3']) self.assertEqual(response.json()['tags'], ['tag1', 'tag2', 'tag3']) diff --git a/backend/toolshed/tests/test_friend.py b/backend/toolshed/tests/test_friend.py index 31132a3..fba1a42 100644 --- a/backend/toolshed/tests/test_friend.py +++ b/backend/toolshed/tests/test_friend.py @@ -375,7 +375,6 @@ class FriendRequestCombinedTestCase(UserTestMixin, ToolshedTestCase): def setUp(self): super().setUp() self.prepare_users() - print(self.f) def test_friend_request_combined(self): befriender = self.f['local_user1']