How to use get_drone method in autotest

Best Python code snippet using autotest_python

views.py

Source:views.py Github

copy

Full Screen

...23def global_view():24 try:25 session['login']26 actualisation()27 return render_template("global_view.html",drones=get_drone(), colis=get_Package(), livraisons=get_delivery())28 except Exception as e:29 print(e)30 return redirect("/denied")31def get_Package():32 msg, data = b.get_packageData()33 return data34@app.route("/profil")35def profil():36 try :37 session['login']38 return render_template("profil.html")39 except Exception as e:40 print(e)41 return redirect("/denied")42@app.route("/selectDrone", methods = ['POST'])43def selectDrone():44 idDroneS, idColis = f.selectADrone(request)[0], f.selectADrone(request)[1]45 addReservation(idDroneS, idColis)46 return redirect("/reservations")47@app.route("/reservations")48def reservations():49 colis, packageToDeliver, drones = get_reservation()50 try :51 if session['service'] != 'livraison':52 actualisation()53 return render_template("reservation.html", colis = colis, packageToDeliver = packageToDeliver, drones = drones)54 else:55 return redirect("/denied")56 except Exception as e:57 print(e)58 return redirect("/denied")59def addReservation(idDroneS, idColis):60 login = f.getSession()61 msg = b.addResaData(idDroneS, idColis, login)62 if msg == 'erreur':63 actualisation()64 colis, packageToDeliver, drones = get_reservation()65 return render_template('reservation.html', colis = colis, packageToDeliver = packageToDeliver, drones = drones, msg_add=msg)66 else:67 return redirect("/reservations")68def get_reservation():69 colis = b.Affichage_Reservation()70 packageToDeliverWR = get_packageToDeliver()71 drones = []72 toPop = []73 for p in packageToDeliverWR:74 idp = p['Id_Colis']75 haveResa = b.haveResaData(76 idp) # return l'id du drone (dans une liste) associé à la resa si existe. Sinon return []77 if haveResa != []:78 toPop.append(packageToDeliverWR.index(p))79 packageToDeliverWRNew = [] # Ne contiendra que les colis qui n'ont pas encore de réservation associée80 for p in packageToDeliverWR:81 if packageToDeliverWR.index(p) not in toPop:82 packageToDeliverWRNew.append(p)83 packageToDeliverWR = packageToDeliverWRNew84 for p in packageToDeliverWR:85 masse = p["Masse_Colis"]86 drone = b.ShowDroneData(masse)87 drones.append(drone)88 return colis, packageToDeliverWR, drones89def get_waiting_package():90 msg, data = b.get_waitingPackageData()91 return data92def get_packageToDeliver():93 msg, data = b.get_waitingPackageData()94 return data95@app.route("/livraisons")96def livraisons():97 try :98 if session['service'] != 'commande':99 actualisation()100 return render_template("livraison.html", livraisons=get_delivery())101 else:102 return redirect("/denied")103 except Exception as e:104 print(e)105 return redirect("/denied")106def get_delivery():107 return b.get_delivery()108@app.route("/validLiv", methods=['POST'])109def validLiv():110 msg = f.validDelivery(request)111 if msg == 'erreur':112 return render_template("livraison.html", livraisons=get_delivery(), add = msg)113 else:114 return redirect("/livraisons")115@app.route("/delLiv", methods=['POST'])116def delLiv():117 msg = f.deleteLiv(request)118 if msg == 'erreur':119 return render_template("livraison.html", livraisons=get_delivery(), del_msg = msg)120 else:121 return redirect("/livraisons")122@app.route("/admin")123def admin():124 try :125 if session['service']=='admin':126 actualisation()127 return render_template("admin.html",personnes=get_employee(), drones=get_drone(), colis=get_Package())128 else:129 return redirect("/denied")130 except Exception as e:131 print(e)132 return redirect("/denied")133def get_employee():134 msg, data = b.get_employeeData()135 return data136def get_drone():137 msg, data = b.get_droneData()138 return data139@app.route("/denied")140def denied():141 return render_template("denied.html")142@app.route("/login_request", methods = ['POST'])143def login_request():144 msg = f.verifAuth(request)145 if msg == "erreur":146 return render_template('login.html', info = msg)147 else :148 return redirect("/global_view")149@app.route("/newPackage", methods = ['POST'])150def newPackage():151 msg = f.addPackage(request)152 if msg == "erreur":153 actualisation()154 return render_template("admin.html",personnes=get_employee(), drones=get_drone(), colis=get_Package(),msg_pack_add=msg)155 else:156 return redirect("/admin")157@app.route("/delPerson", methods = ['POST'])158def delPerson():159 msg = f.deletePeople(request)160 if msg == 'erreur':161 actualisation()162 return render_template("admin.html",personnes=get_employee(), drones=get_drone(), colis=get_Package(), del_per=msg)163 else:164 return redirect("/admin")165@app.route("/delResa", methods = ['POST'])166def delResa():167 msg = f.deleteResa(request)168 if msg == 'erreur':169 actualisation()170 colis, packageToDeliver, drones = get_reservation()171 return render_template('reservation.html', colis=colis, packageToDeliver=packageToDeliver, drones=drones, msg_del=msg)172 else:173 return redirect("/reservations")174@app.route('/newPerson', methods = ['POST'])175def newPerson():176 msg = f.addSomeone(request)177 if msg == 'erreur':178 actualisation()179 return render_template("admin.html",personnes=get_employee(), drones=get_drone(), colis=get_Package(), msg_emp=msg)180 else:181 return redirect("/admin")182@app.route('/newDrone', methods = ['POST'])183def newDrone():184 msg = f.addDrone(request)185 if msg == 'erreur':186 actualisation()187 return render_template("admin.html",personnes=get_employee(), drones=get_drone(), colis=get_Package(), msg_dro=msg)188 else:189 return redirect("/admin")190@app.route('/delDrone', methods = ['POST'])191def delDrone():192 msg = f.deleteDrone(request)193 if msg == 'erreur':194 actualisation()195 return render_template("admin.html",personnes=get_employee(), drones=get_drone(), colis=get_Package(), msg_dro=msg)196 else:197 return redirect("/admin")198@app.route('/delPackage', methods = ['POST'])199def delPackage():200 msg = f.deletePackage(request)201 if msg == 'erreur':202 actualisation()203 return render_template("admin.html",personnes=get_employee(), drones=get_drone(), colis=get_Package(), msg_pack_del=msg)204 else:205 return redirect("/admin")206@app.route('/changePassword', methods=['POST'])207def changePassword():208 msg = f.changeMdp(request)209 if msg =='erreur':210 return render_template('profil.html', msg = msg)211 else:212 return redirect('/profil')213@app.route("/lemoine")214def lemoine():215 return render_template("lemoine.html")216@app.route("/rivoalen")217def rivoalen():218 return render_template("rivoalen.html")219@app.route("/allietta")220def allietta():221 return render_template("allietta.html")222@app.route("/jouquey")223def jouquey():224 return render_template("jouquey.html")225@app.route('/addComment', methods = ['POST'])226def commentaire():227 msg = f.addComment(request)228 if msg == 'erreur':229 return render_template('index.html', comment = msg)230 else:231 return redirect("/")232@app.route('/addNewsletter', methods = ['POST'])233def addNewsletter():234 msg = f.addNewsletter(request)235 if msg == 'erreur':236 return render_template('index.html', news = msg)237 else:238 return redirect("/")239@app.route("/serviceclient")240def serviceclient():241 return render_template('service_client.html', messages = b.getContact())242@app.route("/sendRes", methods=['POST'])243def sendRes():244 mail,base = f.sendResponse(request)245 if mail == "erreur" or base == "erreur":246 return render_template("service_client.html",messages = b.getContact(), contact = "erreur")247 else:248 return redirect("/serviceclient")249@app.route("/sendNews", methods=['POST'])250def sendNews():251 mail= f.sendNews(request)252 if mail == "erreur":253 return render_template("service_client.html", newsletter = "erreur")254 else:255 return redirect("/serviceclient")256@app.route("/maintenance")257def maintenance():258 try :259 if session['service']=='admin' or session['service']=='maintenance':260 actualisation()261 return render_template("maintenance.html", drones_maintenance = get_drone_maintenance(), drones = get_drone())262 else:263 return redirect("/denied")264 except Exception as e:265 print(e)266 return redirect("/denied")267def get_drone_maintenance():268 res = b.get_maintenance()269 return res270@app.route("/maintenanceDrone", methods = ['POST'])271def maintenanceDrone():272 msg = f.maintenanceDrone(request)273 if msg == "erreur":274 return render_template("maintenance.html", msg = msg)275 else:...

Full Screen

Full Screen

domain.py

Source:domain.py Github

copy

Full Screen

...33 @property34 def get_chromosome(self):35 return self.__x36 @property37 def get_drone(self):38 return self.__drone39 @property40 def get_map(self):41 return self.__drone_map42 def read_sensors(self, x, y):43 readings = [0, 0, 0, 0]44 # UP45 xf = x - 146 while (xf >= 0) and (self.get_map.surface[xf][y] == 0):47 if (xf, y) not in self.__visited:48 readings[UP] = readings[UP] + 149 self.__visited.append((xf, y))50 xf = xf - 151 # DOWN...

Full Screen

Full Screen

server.py

Source:server.py Github

copy

Full Screen

...7from droneapp.models.drone_manager import DroneManager8import config9logger = logging.getLogger(__name__)10app = config.app11def get_drone():12 return DroneManager()13@app.route('/')14def index():15 return render_template('index.html')16@app.route('/controller/')17def controller():18 return render_template('controller.html')19@app.route('/api/command/', methods=['POST'])20def command():21 cmd = request.form.get('command')22 logger.info({'action': 'command', 'cmd': cmd})23 drone = get_drone()24 if cmd == 'takeOff':25 drone.takeoff()26 if cmd == 'land':27 drone.land()28 if cmd == 'speed':29 speed = request.form.get('speed')30 logger.info({'action': 'command', 'cmd': cmd, 'speed': speed})31 if speed:32 drone.set_speed(int(speed))33 if cmd == 'up':34 drone.up()35 if cmd == 'down':36 drone.down()37 if cmd == 'forward':38 drone.forward()39 if cmd == 'back':40 drone.back()41 if cmd == 'clockwise':42 drone.clockwise()43 if cmd == 'counterClockwise':44 drone.counter_clockwise()45 if cmd == 'left':46 drone.left()47 if cmd == 'right':48 drone.right()49 if cmd == 'flipFront':50 drone.flip_front()51 if cmd == 'flipBack':52 drone.flip_back()53 if cmd == 'flipLeft':54 drone.flip_left()55 if cmd == 'flipRight':56 drone.flip_right()57 if cmd == 'patrol':58 drone.patrol()59 if cmd == 'stopPatrol':60 drone.stop_patrol()61 if cmd == 'faceDetectAndTrack':62 drone.enable_face_detect()63 if cmd == 'stopFaceDetectAndTrack':64 drone.disable_face_detect()65 if cmd == 'snapshot':66 if drone.snapshot():67 return jsonify(status='success'), 20068 else:69 return jsonify(status='fail'), 40070 return jsonify(status='success'), 20071def video_generator():72 drone = get_drone()73 for jpeg in drone.video_jpeg_generator():74 yield (b'--frame\r\n'75 b'Content-Type: image/jpeg\r\n\r\n' +76 jpeg +77 b'\r\n\r\n')78@app.route('/video/streaming')79def video_feed():80 return Response(81 video_generator(),82 mimetype='multipart/x-mixed-replace; boundary=frame')83def get_courses(course_id=None):84 drone = get_drone()85 courses = droneapp.models.course.get_courses(drone)86 if course_id:87 return courses.get(course_id)88 return courses89@app.route('/games/shake/')90def game_shake():91 courses = get_courses()92 return render_template('games/shake.html', courses=courses)93@app.route('/api/shake/start', methods=['GET', 'POST'])94def shake_start():95 course_id = request.args.get('id')96 # course_id = request.form.get('id')97 course = get_courses(int(course_id))98 course.start()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful