How to use test_add_and_delete method in autotest

Best Python code snippet using autotest_python

test_photo_service.py

Source:test_photo_service.py Github

copy

Full Screen

...71 assert saved_photo.width > 072 assert saved_photo.height > 073 assert saved_photo.media_type == MediaType.IMAGE74 @pytest.mark.asyncio75 async def test_add_and_delete(self, app_settings, db, photo_factory):76 logger.debug('test_add_and_delete')77 photo = photo_factory()78 file = FileStorage(stream=open(photo.path, 'rb'), filename=photo.filename)79 saved_photo = await add_photo(db, PhotoSchemaAdd.parse_obj(vars(photo)), file)80 await delete_photo(db, saved_photo.id)81 assert not os.path.exists(saved_photo.path)82 assert not os.path.exists(saved_photo.thumbnail_path)83 assert not await get_photo(db, saved_photo.id)84 @pytest.mark.asyncio85 async def test_add_and_update(self, photo_factory, db):86 today = datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S")87 today = datetime.datetime.strptime(today, "%Y-%m-%d %H:%M:%S")88 logger.debug('test_add_and_delete')89 photo = photo_factory()...

Full Screen

Full Screen

test_tongxun.py

Source:test_tongxun.py Github

copy

Full Screen

...15 department = "1"16 r = self.user.add(userid=userid, name=name, mobile=mobile, department=department)17 assert r.status_code == 20018 assert r.json()["errcode"] == 019 def test_add_and_delete(self):20 name = "lN"21 userid = "liumengqing"22 pg = PhoneNOGenerator()23 mobile = pg.phoneNORandomGenerator()24 self.user.add_and_delete(name=name, userid=userid, mobile=mobile, department=[]25 )26 @pytest.mark.parametrize("userid, user_name", [27 ['liumengqing', 'Zreturn_'],28 ['liumengqing', 'UIAutomartor'],29 ['liumengqing', 'mitmproxy[中文]'],30 ])31 def test_update_user(self, userid, user_name):32 user_name = user_name + str(datetime.datetime.now().strftime("%Y%m%d-%H%M%S"))33 r = self.user.update(userid=userid, user_name=user_name)...

Full Screen

Full Screen

tests.py

Source:tests.py Github

copy

Full Screen

...13 def test_tree(self):14 ''' test for department/tree '''15 response = self.client.get(path='/api/department/tree')16 self.assertEqual(response.json()['code'], 200)17 def test_add_and_delete(self):18 ''' test for department/add '''19 path = '/api/department/add'20 paras = {21 'parent_id': 1,22 'name': '子部门'23 }24 response = self.client.post(path, data=json.dumps(paras), content_type='json')25 self.assertEqual(response.json()['code'], 200)26 path = '/api/department/delete'27 paras = {28 'id': 229 }30 response = self.client.post(path, data=json.dumps(paras), content_type='json')31 self.assertEqual(response.json()['code'], 200)...

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