How to use validate_duration method in yandex-tank

Best Python code snippet using yandex-tank

test_stepper.py

Source:test_stepper.py Github

copy

Full Screen

...15 ]16 # line duration 2m = 2 * 60 * 1000 = 120000 ms17 # steps duration ((150 - 100) / 5 + 1) * 1 * 60 * 1000 = 660000 ms18 self.assertEqual(fire_duration(f), 120000 + 660000)19 def test_validate_duration(self):20 # only two letters allowed in short notation21 # 'm' - minutes; 'h' - hours22 self.assertTrue(validate_duration('123'))23 self.assertTrue(validate_duration('123m'))24 self.assertTrue(validate_duration('123h'))25 self.assertFalse(validate_duration('123 light years'))26 def test_trans_to_ms(self):27 # trying to translate malformed duration28 with self.assertRaises(StepperSchemaFormat):29 trans_to_ms('123 light years', [])30 self.assertEqual(trans_to_ms('2m', []), 120000)...

Full Screen

Full Screen

appointment.py

Source:appointment.py Github

copy

Full Screen

2from flask_app.db.base import BaseDocument3from flask_app.resources.utils.appointments import (4 validate_new_appointment5)6def validate_duration(val):7 if not isinstance(val, int):8 raise mongoengine.ValidationError("Not valid number.")9class Appointment(BaseDocument):10 user = mongoengine.StringField()11 service = mongoengine.StringField()12 service_name = mongoengine.StringField()13 date = mongoengine.StringField()14 duration = mongoengine.IntField(validation=validate_duration)15 def save(self, new_password_check: bool = False, *args, **kwargs):16 if not validate_new_appointment(self, allow_past=True):17 errors = {18 "date": {self.date: "Collision with other date."},19 "duration": {self.duration: "Collision with other date."},20 }...

Full Screen

Full Screen

service.py

Source:service.py Github

copy

Full Screen

2from flask_app.db.base import BaseDocument3def validate_name(val):4 if val == '':5 raise mongoengine.ValidationError("Can't be blank")6def validate_duration(val):7 if val == '':8 raise mongoengine.ValidationError("Can't be blank")9def validate_price(val):10 if val == '':11 raise mongoengine.ValidationError("Can't be blank")12class Service(BaseDocument):13 name = mongoengine.StringField(validation=validate_name)14 duration = mongoengine.IntField(validation=validate_duration)...

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 yandex-tank 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