How to use get_unique_name method in autotest

Best Python code snippet using autotest_python

test_user.py

Source:test_user.py Github

copy

Full Screen

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)...

Full Screen

Full Screen

test_premium_export_utils.py

Source:test_premium_export_utils.py Github

copy

Full Screen

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>",...

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