summaryrefslogtreecommitdiff
path: root/cases/object/test_applicationgroups.py
blob: 1b27965ab8f5b82e1e76567efc4c599cd9b268b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# -*- 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)