How to use test_tag_api method in localstack

Best Python code snippet using localstack_python

test_tag_api.py

Source: test_tag_api.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2# @Time :2020/​12/​13 17:243# @Author :robot_zsj4# @File :test_tag_api.py5import pytest6from homework.api.one.tag_api import TagApi7class TestTagAPi:8 def setup_class(self):9 # todo: 数据清理10 self.tag = TagApi()11 self.tag.get_token()12 # 每条案例之前清除数据13 def setup(self):14 r = self.tag.list()15 tag_group = r.json()['tag_group']16 if len(tag_group) != 0:17 self.group_tag_get(tag_group)18 self.data_delete(self.data)19 self.setup()20 # 获取标签21 def test_tag_list(self):22 # todo: 完善功能23 r = self.tag.list()24 assert r.json()['errcode'] == 025 # 标签添加26 @pytest.mark.parametrize("group_name, tags_name", [27 ["group_1", [{"name": "robot1"}]],28 ["group_2", [{"name": "robot2"}]]29 ])30 def test_tag_add(self, group_name, tags_name):31 r = self.tag.list()32 assert r.json()['errcode'] == 033 r = self.tag.add(group_name, tags_name)34 assert r.json()['errcode'] == 035 r = self.tag.list()36 assert r.json()['errcode'] == 037 group = [group for group in r.json()['tag_group'] if group['group_name'] == group_name][0]38 tags = [{'name': tag['name']} for tag in group['tag']]39 print(group)40 print(tags)41 assert group['group_name'] == group_name42 assert tags == tags_name43 # 标签删除44 @pytest.mark.parametrize("group_name, tags_name", [45 ["group_1", [{"name": "robot1"}]],46 ["group_2", [{"name": "robot2"}]]47 ])48 def test_tag_delete(self, group_name, tags_name):49 r = self.tag.add(group_name, tags_name)50 assert r.json()['errcode'] == 051 r = self.tag.list()52 assert r.json()['errcode'] == 053 tag_group = r.json()['tag_group']54 if len(tag_group) != 0:55 self.group_tag_get(tag_group)56 for group_id, tag_id in self.data.items():57 res = self.test_delete([group_id], tag_id)58 print(res)59 def test_update(self):60 pass61 def test_tag_add_fail(self):62 pass63 # 存储现有标签64 def group_tag_get(self, tag_group):65 g_id_dict = {}66 for item in tag_group:67 g_id = item['group_id']68 t_id_list = []69 for t in item['tag']:70 t_id_list.append(t['id'])71 g_id_dict[g_id] = t_id_list72 self.data = g_id_dict73 # 删除现有标签74 def data_delete(self, dict_data: dict):75 for group_id, tag_id in dict_data.items():76 self.test_delete([group_id], tag_id)77 # 删除标签78 def test_delete(self, group_id, tag_id):79 r = self.tag.delete(group_id, tag_id)80 # res = r.json()81 print(r.json())...

Full Screen

Full Screen

tests.py

Source: tests.py Github

copy

Full Screen

...4 @classmethod5 def setUpTestData(cls):6 super().setUpTestData()7 cls.tags = TagFactory.create_batch(merchant=cls.merchant, size=3)8 def test_tag_api(self):9 self.client.force_authenticate(self.driver)10 resp = self.client.get('/​api/​mobile/​tags/​v1/​')11 self.assertEqual(resp.status_code, 200)...

Full Screen

Full Screen

__init__.py

Source: __init__.py Github

copy

Full Screen

1from .test_misc import TestMisc2from .test_routes import TestRoutes3from .test_tag_api import TestTagApi...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Considering Agile Principles from a different angle

In addition to the four values, the Agile Manifesto contains twelve principles that are used as guides for all methodologies included under the Agile movement, such as XP, Scrum, and Kanban.

Best 23 Web Design Trends To Follow In 2023

Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.

Nov’22 Updates: Live With Automation Testing On OTT Streaming Devices, Test On Samsung Galaxy Z Fold4, Galaxy Z Flip4, & More

Hola Testers! Hope you all had a great Thanksgiving weekend! To make this time more memorable, we at LambdaTest have something to offer you as a token of appreciation.

Testing in Production: A Detailed Guide

When most firms employed a waterfall development model, it was widely joked about in the industry that Google kept its products in beta forever. Google has been a pioneer in making the case for in-production testing. Traditionally, before a build could go live, a tester was responsible for testing all scenarios, both defined and extempore, in a testing environment. However, this concept is evolving on multiple fronts today. For example, the tester is no longer testing alone. Developers, designers, build engineers, other stakeholders, and end users, both inside and outside the product team, are testing the product and providing feedback.

Agile in Distributed Development – A Formula for Success

Agile has unquestionable benefits. The mainstream method has assisted numerous businesses in increasing organizational flexibility as a result, developing better, more intuitive software. Distributed development is also an important strategy for software companies. It gives access to global talent, the use of offshore outsourcing to reduce operating costs, and round-the-clock development.

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 localstack 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