# -*- coding: UTF-8 -*- import configparser import copy import os import time import uuid import pytest from common.read_data.read_data import ReadData from common.ui_common.objects.application_groups import AppGroup from cases.conftest import demo_fixture from config.workpath import workdir data = ReadData() class Testappgroups: #24.1.3 main pass #24.1.22 PASS 修改name查询时modify存在的问题 #New代表新建app,Not表示不新建 @pytest.mark.parametrize( "data", [ { "ids": "appgroup的增删改查:Name查询", "CreatType": "AppGroup", "Search_type": "Name", "Name": f"AppGroup引用计数测试_{uuid.uuid4()}", "type":"Not" }, { "ids": "appgroup的增删改查:Name查询", "CreatType": "AppGroup", "Search_type": "Name", "Name": f"AppGroup引用计数测试_{uuid.uuid4()}", "type": "New" } ] ) def test_appgroup(self, demo_fixture, data): groups = AppGroup(demo_fixture) groups.AppGroups_case(data) # 24.1.22 PASS 通过id查询 # @pytest.mark.parametrize( # "data", # [ # { # "ids": "appgroup的增删改查:ID查询", # "CreatType": "AppGroup", # "Search_type": "Name", # "Name": f"AppGroup引用计数测试_{uuid.uuid4()}", # "type":"Not" # # } # ] # ) # def test_appgroup(self, demo_fixture, data): # groups = AppGroup(demo_fixture) # groups.search_by_id(data) #24.1.22pass #24.1.3 pass #输入框正向测试 pass @pytest.mark.parametrize( "data", [ { "ids": "AppGroup name输入框正向测试", "Search_type": "Name", "CheckName":"length", }, { "ids": "AppGroup name输入框正向测试", "Search_type": "Name", "CheckName": "multi", } ] ) def test_input_name(self, demo_fixture, data): groups = AppGroup(demo_fixture) groups.input_name_test(data) #24.1.22pass #24.1.3pass #输入框测试:12、13 PASS def test_item_input_frame_reverse(self, demo_fixture): apns = AppGroup(demo_fixture) apns.item_input_frame_reverse_test() #24.10rule缺少app group选项 #无法删除被引用04、查看引用计数05,需要有Name和delete_mode字段 #pass @pytest.mark.parametrize( "data", [ { "ids": "AppGroup引用计数的相关内容", "Search_type": "Name", "Name":f"AppGroup引用计数测试_{uuid.uuid4()}", "delete_mode":"security", "type":"Not" } ] ) def test_reference_thing(self, demo_fixture, data): groups = AppGroup(demo_fixture) groups._quoted_object_test(data) #列设置 pass def test_column_settings_case(self, demo_fixture): groups = AppGroup(demo_fixture) groups.group_column_settings_case() #翻页 pass @pytest.mark.parametrize("data", data.read_data_object(r"URLs\\pages_turning.json"), ids=data.generate_id) def test_page_turning(self, demo_fixture, data): groups = AppGroup(demo_fixture) groups._goto_subObjectPage() groups.objects_po.pages_turning(data) #24.10缺少audit log #Audit Logs功能 Bug Fail @pytest.mark.parametrize( "data", [ { "ids": "AppGroup的Audit Logs:增加和编辑", "Search_type": "Name", "Name":f"测试Audit Logs功能_{uuid.uuid4()}", "type":"Not" } ] ) def test_audit_case(self, demo_fixture, data): groups = AppGroup(demo_fixture) groups._verify_audit_logs(data) # 24.10详情页缺少total值 @pytest.mark.parametrize("data", [ { "ids": "AppGroup的Audit Logs:增加和编辑", "Search_type": "Name", "Name": f"测试Audit Logs功能_{uuid.uuid4()}", "type": "Not" } ]) def test_verify_items_total(self, demo_fixture, data): groups = AppGroup(demo_fixture) groups._verify_items_total(data) def test_item_search_function_in_edit_page(self, demo_fixture): apns = AppGroup(demo_fixture) apns.item_search_verify() @pytest.mark.skip("app group界面暂无clear couter") @pytest.mark.parametrize( "data", [ { "ids": "选中对象组", #"//": "注释!,page_flag = 0 --列表页,page_flag =1--详情页", "page_flag": 0, # "///": "注释!selected items Type=0选中对象,selected items Type=1则选中对象组,selected items Type=2则选中对象和对象组,selected items Type=3则任意非本Vsys的对象", "selected_object_type": 1, # "////": "注释!selected_objects 要选中的条数,如selected_objects =-1,则随机条数", "selected_objects": -1, "selected_data": -1, # "/////": "注释!,detail_type = 0 --Object详情页,detail_type =1--Object Group详情页,detail_type=2--非本Vsys的Object详情页", "detail_type": 0 }, { "ids": "对象组详情页", "page_flag": 1, "selected_object_type": 0, "selected_objects": -1, "selected_data": -1, "detail_type": 1 } ] ) def test_clearCounter(self, demo_fixture, data): app = AppGroup(demo_fixture) app.test_ClearCounter(data) @pytest.mark.parametrize("data", [ { "ids": "appgroup的Statistics功能", "CreatType": "AppGroup", "Search_type": "Name", "Name": f"AppGroup引用计数测试_{uuid.uuid4()}", "type": "Not" } ]) def test_View_statistics_case(self, demo_fixture, data): a = AppGroup(demo_fixture) a._View_statistics_case(data) # 24.10只有单个条件 @pytest.mark.parametrize("data", [ { "ids": "多个条件组合查询", "CreatType": "AppGroup", "Search_type": "Name", "Name": f"AppGroup组合查询_{uuid.uuid4()}", "type": "Not" } ]) def test_verify_search(self, demo_fixture, data): a = AppGroup(demo_fixture) a.verify_search(data) @pytest.mark.parametrize("data", [ # { # "ids": "include添加,exclude打开未添加校验", # "Name": "test_exclude_not_add", # "subtype": "0", # }, { "ids": "exclude添加,include未添加校验", "Name": "test_include_not_add", "subtype": "1", }, { "ids": "exclude,include均未添加校验", "Name": "test_exclude_include_not_add", "subtype": "2", }, { "ids": "exclude,include均添加校验", "Name": "test_exclude_include_all_add", "subtype": "3", } ]) def test_group_include(self,demo_fixture,data): a = AppGroup(demo_fixture) a.group_object_include(data) # 24.10无detail侧滑搜索 @pytest.mark.parametrize("data", [ { "ids": "appgroup的Statistics功能", "CreatType": "AppGroup", "Search_type": "Name", "Name": "mainPage_item_search", "type": "Not", "Search_value": "http" } ]) def test_item_search(self, demo_fixture, data): a = AppGroup(demo_fixture) a.mainPage_item_search(data) @pytest.mark.parametrize("data", [{ "ids": "appgroup的Statistics功能", "CreatType": "AppGroup", "Search_type": "Name", "Name": "测试不同Vsys的效果", "type": "Not", }]) def test_different_vsys_check(self, demo_fixture, data): a = AppGroup(demo_fixture) a.different_vsys_check(data) @pytest.mark.parametrize("data", [ { "ids": "appgroup的Statistics功能", "CreatType": "AppGroup", "Search_type": "Name", "Name": "测试不同Vsys的效果", "type": "Not", "Search_subordinate_value": "http", "Search_exclude_value":"dns" } ]) def test_sub_objects_drawer_search(self, demo_fixture, data): a = AppGroup(demo_fixture) a._sub_objects_drawer_search(data) @pytest.mark.parametrize("data", [ { "ids": "Audit logs", "CreatType": "AppGroup", "Search_type": "Name", "Name": "测试Audit logs", "type": "Not", } ]) def test_audit_log_all_operation(self, demo_fixture, data): a = AppGroup(demo_fixture) a.audit_log_all_operation(data) @pytest.mark.parametrize("data", [{ "ids": "Name模糊搜索", "CreatType": "AppGroup", "Search_type": "fuzzy->Name", "Name": "test_fuzzy_name", "type": "Not", }]) def test_fuzzy_search(self,demo_fixture,data): a = AppGroup(demo_fixture) a.fuzzy_search(data) @pytest.mark.parametrize("data", [ { "ids": "策略引用计数跳转验证", "CreatType": "AppGroup", "Search_type": "Name", "Name": "test_policy_quote", "type": "Not", } ]) def test_policy_quote_role(self, demo_fixture, data): a = AppGroup(demo_fixture) a.policy_reference_count_check(data)