def test_get_not_found_community_collections(self): """ Test retrieving all collections from an especific not found community """ dspace = self.dspace test_id = -1 self.assertRaises(Community.DoesNotExist,lambda:Community.get_collections(dspace,test_id,expand=["parentCommunity"]))
def get_collections_by_community(request,id): """ Return all collections of the specified community. """ try: collections = Community.get_collections(dspace,id,**dict(request.query_params)) return Response(collections, status=status.HTTP_200_OK) except Community.DoesNotExist: raise Http404
def test_get_community_collections(self): """ Test retrieving all collections from an especific community """ dspace = self.dspace test_id = 2 collections = Community.get_collections(dspace,test_id,expand=["parentCommunity"]) self.assertIsNotNone(collections) for collection in collections: collection_temp = Collection(dict(collection)) self.assertEqual(test_id,collection_temp.parentCommunity["id"])