diff options
| author | zhaokun <[email protected]> | 2024-11-26 14:09:42 +0800 |
|---|---|---|
| committer | zhaokun <[email protected]> | 2024-11-26 14:09:42 +0800 |
| commit | 5fa497b5e4d50f13bde2e41d48a4cc9f65d3df6f (patch) | |
| tree | 7f0abff134ca1cddd2709ccf8d9816c8617086b5 /tests/example | |
| parent | 4fe2464523d8936908bbce4d90084bd6c2aeda72 (diff) | |
Modify object and rule example
Diffstat (limited to 'tests/example')
| -rw-r--r-- | tests/example/test_case_example.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/example/test_case_example.py b/tests/example/test_case_example.py index 2611a6d16..ce4889ec5 100644 --- a/tests/example/test_case_example.py +++ b/tests/example/test_case_example.py @@ -86,12 +86,12 @@ def run(parameter): # 创建 if parameter["initiation_method"] == "ui": ui_client = UIClient() - objects_tuple, ui_error = ui_client.create_objects(policy_configuration) - if len(ui_error) > 0: - return ui_error - rules_tuple, ui_error = ui_client.create_rules(policy_configuration, objects_tuple) - if len(ui_error) > 0: - return ui_error + code = ui_client.create_objects(policy_configuration) + if code != 200: + return "Fail to create object." + code = ui_client.create_rules(policy_configuration, objects_tuple) + if code != 200: + return "Fail to create rule." elif parameter["initiation_method"] == "api": api_client = APIClient(parameter) # {uuid, type}, i.e., {"12341-232-a21", "ip"} @@ -158,7 +158,10 @@ def run(parameter): # 删除 if parameter["initiation_method"] == "ui": if rules_tuple: - ui_client.delete_rules(parameter, policy_configuration, rules_tuple) + ui_client.delete_rules(parameter, rules_tuple) + if objects_tuple: + ui_client.delete_objects(parameter, objects_tuple) + ui_client.cleanup() elif parameter["initiation_method"] == "api": if rules_tuple: api_client.delete_rules(rules_tuple) |
