Best Python code snippet using autotest_python
test_user.py
Source: test_user.py
1# -*- coding: utf-8 -*-2# @Time : 2021/7/18 20:353# @Author : wkRonin4# @File :test_user.py5from faker import Faker6from wechatworkApi.api.user import User7class TestUser:8 def setup_class(self):9 self.user = User()10 self.fake = Faker('zh_CN')11 def test_add(self, get_unique_name):12 """13 æµè¯æ·»å æåæ¥å£14 :param get_unique_name: èªå®ä¹å称15 :return: æè¨æ·»å æåæ¯å¦æå以åæ·»å åæ¯å¦è½æ¥è¯¢å¾å°16 """17 name = self.fake.name()18 mobile = self.fake.phone_number()19 new_userid = self.user.add(get_unique_name, name, mobile, 1).json()20 assert new_userid.get("errcode") == 021 assert self.user.get(get_unique_name).json().get("errcode") == 022 def test_get(self, get_unique_name):23 """24 æµè¯æ¥è¯¢æåæ¥å£25 :param get_unique_name: èªå®ä¹å称26 :return: æè¨æ¯å¦è½æ¥è¯¢å°æ°å¢çæå27 """28 name = self.fake.name()29 mobile = self.fake.phone_number()30 self.user.add(get_unique_name, name, mobile, 1)31 assert self.user.get(get_unique_name).json().get("errcode") == 032 def test_delete(self, get_unique_name):33 """34 æµè¯å é¤æåæ¥å£35 :param get_unique_name: èªå®ä¹å称36 :return: æè¨å é¤æåæ¯å¦æå以åæ¥è¯¢æ¤æåè¿åçé误ç æ¯å¦ä¸ºæåä¸å¨ä¼ä¸ä¸çé误ç 37 """38 name = self.fake.name()39 mobile = self.fake.phone_number()40 self.user.add(get_unique_name, name, mobile, 1)41 assert self.user.delete(get_unique_name).json().get("errcode") == 042 assert self.user.userid_is_not_exist(get_unique_name)43 def test_update(self, get_unique_name):44 """45 æµè¯æ´æ°æåæ¥å£46 :param get_unique_name: èªå®ä¹å称47 :return: æè¨æåå§åæ¯å¦æ´æ°æå48 """49 name = self.fake.name()50 mobile = self.fake.phone_number()51 new_name = self.fake.name()52 self.user.add(get_unique_name, name, mobile, 1)...
test_premium_export_utils.py
Source: test_premium_export_utils.py
1from baserow_premium.export.utils import get_unique_name, safe_xml_tag_name, to_xml2def test_get_unique_name():3 assert get_unique_name({"name": ""}, "name") == "name_2"4 assert get_unique_name({"name": ""}, "name", separator=" ") == "name 2"5 assert get_unique_name({"name": "", "name_2": "", "name_4": ""}, "name") == "name_3"6 assert (7 get_unique_name({"name": "", "name_2": "", "name_3": "", "name_4": ""}, "name")8 == "name_5"9 )10 assert (11 get_unique_name({"name": "", "name_2": "", "name_3": "", "name_4": ""}, "else")12 == "else"13 )14def test_safe_xml_tag_name():15 assert safe_xml_tag_name("name") == "name"16 assert safe_xml_tag_name("/name<>") == "name"17 assert safe_xml_tag_name("/name<>test") == "name-test"18 assert safe_xml_tag_name("Test 1 // <> @#$$%&%*$^%&%") == "Test-1"19 assert safe_xml_tag_name("123") == "tag-123"20 assert safe_xml_tag_name("123", "prefix-") == "prefix-123"21 assert safe_xml_tag_name("/", "prefix-", "empty") == "empty"22def test_to_xml():23 xml = to_xml(24 {25 "name": "<value>",...
Check out the latest blogs from LambdaTest on this topic:
Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.
So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.
Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools
As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????
The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!