def test_valid_query_cases_response_old_doc_currently_uploading(self): self.available_doc.available = 0 two_days_ago = datetime.datetime.now() - datetime.timedelta(2) self.available_doc.modified= two_days_ago self.available_doc.save() ppquery = PickledPut(filename=IACommon.get_docketxml_name('nysd', '1234')) ppquery.save() response = self.client.post('/recap/query_cases/', {'json': simplejson.dumps(self.valid_params)}) output= simplejson.loads(response.content) self.assertEquals(2, len(output)) self.assertEquals(self.available_doc.lastdate.strftime("%m/%d/%y"), output['timestamp']) self.assertEquals(IACommon.get_dockethtml_url('nysd', '1234'), output['docket_url']) PickledPut.objects.all().delete()
def test_valid_query_cases_response_available_doc_match(self): response = self.client.post('/recap/query_cases/', {'json': simplejson.dumps(self.valid_params)}) output= simplejson.loads(response.content) self.assertEquals(2, len(output)) self.assertEquals(self.available_doc.lastdate.strftime("%m/%d/%y"), output['timestamp']) self.assertEquals(IACommon.get_dockethtml_url('nysd', '1234'), output['docket_url'])
def test_valid_query_cases_response_unavailable_doc_currently_uploading(self): self.available_doc.available = 0 self.available_doc.save() ppquery = PickledPut(filename=IACommon.get_docketxml_name('nysd', '1234')) ppquery.save() response = self.client.post('/recap/query_cases/', {'json': simplejson.dumps(self.valid_params)}) self.assertEquals("{}", response.content) PickledPut.objects.all().delete()
def _ia_url_for_doc(self, doc): return IACommon.get_pdf_url(doc.court, doc.casenum, doc.docnum, doc.subdocnum)