示例#1
0
 def test_get_not_found_collection_items(self):
     """
     Test retrieving all items from an especific not found collection
     """
     dspace =  self.dspace
     test_id = -1
     self.assertRaises(Collection.DoesNotExist,lambda:Collection.get_items(dspace,test_id,expand=["parentCollection"]))
示例#2
0
def get_items_by_collection(request,id):
    """
    Return all items of the specified collection.
    """
    try:
        items =  Collection.get_items(dspace,id,**dict(request.query_params))
        return  Response(items, status=status.HTTP_200_OK)
    except Collection.DoesNotExist:
        raise Http404
示例#3
0
 def test_get_collection_items(self):
     """
     Test retrieving all items from an especific collection
     """
     dspace =  self.dspace
     test_id = 2
     items = Collection.get_items(dspace,test_id,expand=["parentCollection"])
     self.assertIsNotNone(items)
     for item in items:
         item_temp = Item(dict(item))
         self.assertEqual(test_id,item_temp.parentCollection["id"])