コード例 #1
0
ファイル: tests.py プロジェクト: f14c0/conectate-dspace
 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"]))
コード例 #2
0
ファイル: views.py プロジェクト: f14c0/conectate-dspace
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
コード例 #3
0
ファイル: tests.py プロジェクト: f14c0/conectate-dspace
 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"])