class FTTest(unittest.TestCase): def setUp(self): app.config['TESTING'] = True self.app = app.test_client() r = Report(start=date.today(), finished=False) r.put() self.r = r self.cell = Cell(x=0, y=0, z=2, report=self.r, ndfi_high=1.0, ndfi_low=0.0) self.cell.put() self.area = Area( geo='[[[-61.5,-12],[-61.5,-11],[-60.5,-11],[-60.5,-12]]]', added_by=users.get_current_user(), type=1, cell=self.cell) #self.area.put() def test_save_on_ft(self): self.area.put() self.area.create_fusion_tables() self.assertNotEquals(None, self.area.fusion_tables_id) self.area.type = 2 self.area.save() self.area.update_fusion_tables() self.area.delete() self.area.delete_fusion_tables()
def create(self, report_id, cell_pos): r = Report.get(Key(report_id)) z, x, y = Cell.cell_id(cell_pos) cell = Cell.get_or_create(r, x, y, z) data = json.loads(request.data) a = Area(geo=json.dumps(data["paths"]), type=data["type"], added_by=users.get_current_user(), cell=cell) a.save() cell.last_change_by = users.get_current_user() cell.put() return Response(a.as_json(), mimetype="application/json")
def create(self, report_id, cell_pos): r = Report.get(Key(report_id)) z, x, y = Cell.cell_id(cell_pos) cell = Cell.get_or_create(r, x, y, z) data = json.loads(request.data) a = Area(geo=json.dumps(data['paths']), type=data['type'], added_by=users.get_current_user(), cell=cell) a.save() cell.last_change_by = users.get_current_user() cell.put() return Response(a.as_json(), mimetype='application/json')
class FTTest(unittest.TestCase): def setUp(self): app.config['TESTING'] = True self.app = app.test_client() r = Report(start=date.today(), finished=False) r.put() self.r = r self.cell = Cell(x=0, y=0, z=2, report=self.r, ndfi_high=1.0, ndfi_low=0.0) self.cell.put() self.area = Area(geo='[[[-61.5,-12],[-61.5,-11],[-60.5,-11],[-60.5,-12]]]', added_by=users.get_current_user(), type=1, cell=self.cell) #self.area.put() def test_save_on_ft(self): self.area.put() self.area.create_fusion_tables() self.assertNotEquals(None, self.area.fusion_tables_id) self.area.type = 2 self.area.save() self.area.update_fusion_tables() self.area.delete() self.area.delete_fusion_tables()