def case_upload_case_ids(request, domain, upload_id): try: case_upload = CaseUploadRecord.objects.get(upload_id=upload_id, domain=domain) except CaseUploadRecord.DoesNotExist: return HttpResponseNotFound() ids_stream = ('{}\n'.format(case_id) for case_id in get_case_ids_for_case_upload(case_upload)) return StreamingHttpResponse(ids_stream, content_type='text/plain')
def case_upload_case_ids(request, domain, upload_id): try: case_upload = CaseUploadRecord.objects.get(upload_id=upload_id, domain=domain) except CaseUploadRecord.DoesNotExist: return HttpResponseNotFound() ids_stream = ('{}\n'.format(case_id) for case_id in get_case_ids_for_case_upload(case_upload)) return StreamingHttpResponse(ids_stream, content_type='text/plain')
def case_upload_case_ids(request, domain, upload_id): try: case_upload = _get_case_upload_record(domain, upload_id, request.couch_user) except CaseUploadRecord.DoesNotExist: return HttpResponseNotFound() ids_stream = ('{}\n'.format(case_id) for case_id in get_case_ids_for_case_upload(case_upload)) return StreamingHttpResponse(ids_stream, content_type='text/plain')
def test_order(self): data = [ ['name'], ['john'], ['paul'], ['george'], ['ringo'], ] case_upload_record = self._import_rows(data) case_ids = list(get_case_ids_for_case_upload(case_upload_record)) cases = CaseAccessors(self.domain).get_cases(case_ids, ordered=True) self.assertEqual(case_ids, [case.case_id for case in cases])
def test_order(self): data = [ ['name'], ['john'], ['paul'], ['george'], ['ringo'], ] case_upload_record = self._import_rows(data) case_ids = list(get_case_ids_for_case_upload(case_upload_record)) cases = CaseAccessors(self.domain).get_cases(case_ids, ordered=True) self.assertEqual(case_ids, [case.case_id for case in cases]) should_match_original_data_order = [['name']] + [[case.name] for case in cases] self.assertEqual(should_match_original_data_order, data)