def test_delete_calfeed(self): save_calfeed('testfile2', b'hi') cf = get_calfeed('testfile2') self.assertEqual(cf, 'hi') delete_calfeed('testfile2') with self.assertRaises(ValueError): cf = get_calfeed('testfile2')
def calfeed(request, pk): try: if settings.DYNAMIC_CALFEED: # if the dynamic calfeed is set, just create the calfeed right now and return it tf = prepare_calfeed(Member.objects.get(cal_feed_id=pk)) else: # if using the task queue, get the calfeed from the disk cache tf = get_calfeed(pk) except (ValueError, ValidationError): hr = HttpResponse() hr.status_code = 404 return hr return HttpResponse(tf)
def band_calfeed(request, pk): try: if settings.DYNAMIC_CALFEED: # if the dynamic calfeed is set, just create the calfeed right now and return it tf = prepare_band_calfeed(Band.objects.get(pub_cal_feed_id=pk)) else: # if using the task queue, get the calfeed from the disk cache tf = get_calfeed(pk) except (ValueError, ValidationError): hr = HttpResponse() hr.status_code = 404 return hr response = HttpResponse(tf) response.headers['Access-Control-Allow-Origin'] = '*' return response
def test_calfeed_save_content(self): save_calfeed('testfile2', b'hi') cf = get_calfeed('testfile2') self.assertEqual(cf, 'hi')
def test_calfeed_save_and_get(self): save_calfeed('testfile1', b'') cf = get_calfeed('testfile1') self.assertEqual(cf, '')