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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
|
# -*- coding: UTF-8 -*-
import copy
import time
import uuid
import pytest
from common.read_data.read_data import ReadData
from common.ui_common.objects.applications import *
from cases.conftest import demo_fixture
data = ReadData()
class Testapp:
@pytest.mark.parametrize("data",data.read_data_object("application.json"), ids=data.generate_id )
def test_app(self, demo_fixture,data):
app = App(demo_fixture)
app.app_case(data)
@pytest.mark.parametrize("data", data.read_data_object("application_select.json"), ids=data.generate_id)
def test_select(self, demo_fixture, data):
app = App(demo_fixture)
app.select_set_case(data)
# 24.10无法导入
@pytest.mark.parametrize(
"data",
[
{
"type": 0
}
]
)
def test_import_json(self,demo_fixture,data):
app = App(demo_fixture)
app.import_app_case(data)
assert ['Success', '小袁搜题_20230716'] == app.text
@pytest.mark.parametrize("data",
[
{
"ids": "勾选后取消部分,成功导出",
"type": 1,
"isFileDelets": "true"
},
{
"ids": "勾选后取消所有,不能导出",
"type": 2,
"isFileDelets": "true"
},
{
"ids": "直接导出所有",
"type": 3,
"isFileDelets": "true"
}
])
def test_export_file(self, data):
driver = getwebdriver()
app = App(driver)
app.export_app_file_case(data)
driver.quit()
@pytest.mark.parametrize("data", data.read_data_object("application_turnpage.json"), ids=data.generate_id)
def test_turn_page(self, demo_fixture, data):
app = App(demo_fixture)
app.turn_page_case(data)
def test_checkout_create_and_edit(self,demo_fixture):
app = App(demo_fixture)
app.checkout_edit_and_create()
def test_input_error_name(self,demo_fixture):
app = App(demo_fixture)
app.input_error_name_case()
def test_upload_error_file(self,demo_fixture):
app = App(demo_fixture)
app.upload_error_file_case()
def test_no_input_must(self,demo_fixture):
app = App(demo_fixture)
app.no_input_must_case()
def test_upload_repeat_file(self,demo_fixture):
app = App(demo_fixture)
app.upload_repeat_file_case()
def test_input_out_limit(self,demo_fixture):
app = App(demo_fixture)
app.input_out_limit_case()
def test_timeout_over_limit_case(self,demo_fixture):
app = App(demo_fixture)
app.timeout_over_limit_case()
# @pytest.mark.parametrize(
# "data",
# [
# {
# "ids": "All_Signatures1",
# "CreatType": "Signature",
# "AttributeType":["udp","tcp"],
# "Search_type": "ID",
# "AddToCondition":"New Condition",
# "type": 1,
# "isFileDelets":"false",
# "isNewAttribute": "",
# },
# {
# "ids": "All_Signatures1",
# "CreatType": "Signature",
# "AttributeType": ["ip", "common","dns"],
# "Search_type": "ID",
# "AddToCondition": "New Condition",
# "type": 1,
# "isFileDelets": "false",
# "isNewAttribute": "",
# },
# {
# "ids": "All_Signatures1",
# "CreatType": "Signature",
# "AttributeType": ["http", "ssl"],
# "Search_type": "ID",
# "AddToCondition": "New Condition",
# "type": 1,
# "isFileDelets": "false",
# "isNewAttribute": "",
# },
# {
# "ids": "All_Signatures2",
# "CreatType": "Signature",
# "AttributeType": ["udp", "tcp", "common", "ip", "dns", "http"],
# "Search_type": "ID",
# "AddToCondition": "New Not Condition",
# "type": 1,
# "isFileDelets": "false",
# "isNewAttribute": "",
# }
# ]
# )
# def test_app_all_signature(self,data):
# # signatures = App(demo_fixture)
# driver = getwebdriver()
# signatures = App(driver)
# signatures.create_all_app_signatures(data)
# driver.quit()
#1.22 pass 需提前删除test-serverip;App中新增Condition
def test_new_Signatures(self,demo_fixture):
app = App(demo_fixture)
app.New_Signatures_case()
#1.22pass
#Application中修改特征;运行前需删除name为test_general_fqdn的特征
@pytest.mark.parametrize("data",
[
{
"ids": "edit_to_sni",
"type": "sni",
},
{
"ids": "edit_to_dns",
"type": "dns",
},
{
"ids": "edit_to_host",
"type": "host",
},
{
"ids":"fqdn_test",
"type":"general_fqdn"
}
])
def test_edit_sigatures_in_app(self,demo_fixture,data):
app = App(demo_fixture)
app.Edit_Signatures_all_case(data)
# Application中新建Object,Object中修改
# 需要提前删除test-ip,pass
@pytest.mark.parametrize("data",
[
{
"ids": "修改fqdn",
"type": "fqdn",
}
])
def test_edit_fqdn_item_in_object(self, demo_fixture, data):
app = App(demo_fixture)
app.modify_vote_ip_fqdn_case(data)
#1.22pass
#signature名称不能重复,要删除test_ip;在Object_signature页面中修改;需要修改成sni
@pytest.mark.parametrize("data",
[
{
"ids": "自定义特征中修改ip",
"type": "ip",
}
,
])
def test_modify_vote_user_defined_signature_in_object_signature(self,demo_fixture,data):
app = App(demo_fixture)
app.modify_vote_user_defined_signature_case(data)
#24.1.5 pass
def test_find_check_box(self, demo_fixture):
app = App(demo_fixture)
app.find_check_box()
#24.1.5pass 3.4运行需要删除test_change_drop (ui自动化vsys)
@pytest.mark.parametrize("data",
[
{
"ids": "选择drop勾选Send TCP reset",
"model": 1,
"expect":"0"
},
{
"ids": "选择drop勾选Send TCP reset,勾选Send ICMP Unreachable",
"model": 2,
"expect": "0"
},
{
"ids": "修改drop为10",
"model": 3,
"expect": "10"
},
{
"ids": "修改rate_limiting为drop",
"model": 4,
"expect": "0"
}
])
def test_checkout_defined_drop(self,demo_fixture,data):
app = App(demo_fixture)
app.check_define_default_drop(data)
assert data["expect"] == app.text
#24.1.4pass 1和2
@pytest.mark.parametrize("data",
[
{
"ids": "选择drop勾选Send TCP reset",
"model": 1,
"expect": "0"
},
{
"ids": "选择drop勾选Send TCP reset,勾选Send ICMP Unreachable",
"model": 2,
"expect": "0"
},
{
"ids": "修改drop为10",
"model": 3,
"expect": "10"
},
{
"ids": "修改rate_limiting为drop",
"model": 4,
"expect": "0"
}
])
def test_checkout_built_drop(self, demo_fixture, data):
app = App(demo_fixture)
app.check_built_default_drop(data)
assert data["expect"] == app.text
#24.1.4 pass
# 无法删除被引用04、查看引用计数05,需要有Name和delete_mode字段
# pass
@pytest.mark.parametrize(
"data",
[
{
"ids": "App引用计数的相关内容",
"Search_type": "Name",
"Name": f"AppGroup引用计数测试_{uuid.uuid4()}",
"delete_mode": "security"
}
]
)
def test_reference_thing(self, demo_fixture, data):
app = App(demo_fixture)
app._quoted_object_test(data)
#24.1.4 pass
@pytest.mark.parametrize("data",data.read_data_object("appliaction_name_test.json"),ids=data.generate_id)
def test_checkout_name_input(self,demo_fixture,data):
app = App(demo_fixture)
app.checkout_name_input_case(data)
assert data["expect"] == app.tip
#24.1.3 pass
def test_clear_filter(self,demo_fixture):
app = App(demo_fixture)
app.clear_filters()
#24.1.4pass
def test_delete_built(self,demo_fixture):
app = App(demo_fixture)
app.delete_built()
# 24.1.4pass
def test_check_edit_button_present_vsys(self,demo_fixture):
app = App(demo_fixture)
app.check_edit_button_present_vsys()
#24.1.4pass
def test_check_new_column(self,demo_fixture):
app = App(demo_fixture)
app.check_new_column()
#24.1.4pass
def test_check_subcategory(self,demo_fixture):
app = App(demo_fixture)
app.check_subcategory()
@pytest.mark.parametrize(
"data",
[
{
"ids": "App的Audit Logs:增加和编辑",
"Search_type": "Name",
"Name": f"测试Audit Logs功能_{uuid.uuid4()}",
"type": "Not"
}
]
)
def test_audit_case(self, demo_fixture, data):
groups = App(demo_fixture)
groups._verify_audit_logs(data)
@pytest.mark.parametrize("data", [
{
"ids": "App的增删改查",
"CreatType": "App",
"Search_type": "Name"
}
])
def test_View_statistics_case(self, demo_fixture, data):
a = App(demo_fixture)
a._View_statistics_case(data)
@pytest.mark.parametrize(
"data",
[
{
"ids": "App的Audit Logs:增加和编辑",
"Search_type": "Name",
"parent_name": f"新建parent_app_{uuid.uuid4()}",
"type": "Not"
}
]
)
def test_new_parent_app(self, demo_fixture, data):
app = App(demo_fixture)
app.new_parent_app_case(data)
@pytest.mark.parametrize("data", [
{
"ids": "多个条件组合查询",
"Search_type": "ID&Name",
"type": "Not"
}
])
def test_verify_search(self, demo_fixture, data):
app = App(demo_fixture)
app.verify_search(data)
@pytest.mark.parametrize("data", [
{
"ids": "多个条件组合查询",
"app_id": 8009
}
])
def test_edit_built_in_objects(self, demo_fixture,data):
app = App(demo_fixture)
app._edit_built_in_objects(data)
@pytest.mark.parametrize("data", [{
"ids": "check_vsys",
"CreateModel": "0",
"CreateType": "APN",
"Name":"",
"SubType": "",
"Search_type": "Name",
"importCorrectFile": "False",
"isCheckName": "False",
"isCheckObjectFrame": "False",
"customsearch":"test_check_vsys"
}])
def test_different_vsys_check(self, demo_fixture, data):
app = App(demo_fixture)
app.different_vsys_check(data)
@pytest.mark.parametrize("data", [{
"ids": "name模糊搜索",
"CreateModel": "0",
"CreateType": "APN",
"Name":"",
"SubType": "",
"Search_type": "fuzzy->Name",
"importCorrectFile": "False",
"isCheckName": "False",
"isCheckObjectFrame": "False",
}])
def test_fuzzy_search(self, demo_fixture, data):
app = App(demo_fixture)
app.fuzzy_search(data)
# @pytest.mark.parametrize("data", [
# {
# "ids": "多个条件组合查询",
# "Search_type": "ID",
# "type": "Not"
# }
# ])
# def test_audit_log_all_operation(self, demo_fixture, data):
# app = App(demo_fixture)
# app.audit_log_all_operation(data)
@pytest.mark.parametrize("data", [{
"ids": "name模糊搜索",
"search_value": "test_audit_log",
}])
def test_import_audit_log(self,demo_fixture,data):
app = App(demo_fixture)
app.import_app_audit_logs(data)
@pytest.mark.parametrize("data", [
{
"ids": "策略引用计数跳转验证",
"CreatType": "App",
"Search_type": "Name"
}
])
def test_policy_quote_role(self, demo_fixture, data):
app = App(demo_fixture)
app.policy_reference_count_check(data)
|