示例#1
0
文件: dbtest.py 项目: edsu/launchpad
 def test_get_related_items(self):
     i = get_item('2281511')
     expected = set(['2281511', '1278053', '4377796',
                     '5094040'])
     bibids = set(db.get_related_bibids(i))
     # we compare as sets because the order can change
     self.assertEqual(bibids, expected)
示例#2
0
def related(request):
    """
    API call for getting related bibids.
    """
    bibid = request.GET.get('bibid')
    if not bibid:
        raise Http404()
    bibid = db.get_bibid_from_summonid(bibid)
    item = db.get_item(bibid)
    bibids = db.get_related_bibids(item)
    return HttpResponse(
        json.dumps(bibids, indent=2),
        content_type='application/json'
    )
示例#3
0
 def handle(self, *args, **options):
     if len(args) >= 1:
         item = db.get_item(args[0])
         bibids = db.get_related_bibids(item)
         print bibids
示例#4
0
 def test_get_related_items(self):
     i = get_item('2281511')
     expected = set(['2281511', '1278053', '4377796', '5094040'])
     bibids = set(db.get_related_bibids(i))
     # we compare as sets because the order can change
     self.assertEqual(bibids, expected)