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)
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' )
def handle(self, *args, **options): if len(args) >= 1: item = db.get_item(args[0]) bibids = db.get_related_bibids(item) print bibids