def test_create_unit(self): node_id = 1 node = Node(node_id, 0, 0) session.add(node) session.commit() unit_view = UnitView() unit_view.create_unit(node_id)
def _create_item(json): production_id = json['production_id'] result = session.query(Production).filter( Production.id == production_id).delete() if result != 1: raise Exception item = Item(id_generator.generate()) session.add(item) session.commit() return item
def create_production(self) -> Production: production = Production(id_generator.generate()) session.add(production) session.commit() return production
def create_nodes(self): for x in range(5): for y in range(5): node = Node(id_generator.generate(), x * 100, y * 100) session.add(node) session.commit()
def create_unit(self, node_id)->Unit: unit = Unit(id_generator.generate(), node_id) session.add(unit) session.commit() return unit