From 60fdecd49d050518005902bad777ab5f1bed64e0 Mon Sep 17 00:00:00 2001 From: Calvin Remsburg <76797306+cdot65@users.noreply.github.com> Date: Wed, 27 Nov 2024 12:13:57 -0600 Subject: [PATCH] docs-cleanup (#52) * correcting the fields available for service groups * standardize on folders * correcting path --- README.md | 2 +- docs/about/getting-started.md | 6 +- docs/sdk/client.md | 26 +-- docs/sdk/config/objects/service_group.md | 28 ++- .../security_services/decryption_profile.md | 2 +- docs/sdk/config/security_services/index.md | 2 +- .../config/security_services/security_rule.md | 24 +-- .../vulnerability_protection_profile.md | 20 +- .../security_services/wildfire_antivirus.md | 16 +- .../models/objects/address_group_models.md | 14 +- docs/sdk/models/objects/address_models.md | 18 +- .../objects/application_group_models.md | 6 +- docs/sdk/models/objects/application_models.md | 8 +- .../models/objects/service_group_models.md | 82 ++++---- docs/sdk/models/objects/service_models.md | 12 +- docs/sdk/models/objects/tag_models.md | 12 +- .../anti_spyware_profile_models.md | 10 +- .../decryption_profile_models.md | 12 +- .../dns_security_profile_models.md | 14 +- .../security_services/security_rule_models.md | 14 +- ...vulnerability_protection_profile_models.md | 14 +- .../wildfire_antivirus_profile_models.md | 12 +- scm/models/objects/service.py | 2 +- tests/factories.py | 184 +++++++++--------- tests/scm/config/objects/test_address.py | 78 ++++---- .../scm/config/objects/test_address_group.py | 50 ++--- tests/scm/config/objects/test_application.py | 44 ++--- .../config/objects/test_application_group.py | 64 +++--- tests/scm/config/objects/test_service.py | 74 +++---- .../scm/config/objects/test_service_group.py | 48 ++--- tests/scm/config/objects/test_tag.py | 64 +++--- .../security/test_anti_spyware_profile.py | 48 ++--- .../security/test_decryption_profile.py | 48 ++--- .../security/test_dns_security_profile.py | 54 ++--- .../config/security/test_security_rules.py | 100 +++++----- .../test_vulnerability_protection_profiles.py | 56 +++--- .../test_wildfire_antivirus_profiles.py | 42 ++-- .../objects/test_address_group_models.py | 4 +- .../scm/models/objects/test_address_models.py | 4 +- .../objects/test_application_group_models.py | 18 +- .../objects/test_service_group_models.py | 24 +-- .../scm/models/objects/test_service_models.py | 6 +- tests/scm/models/objects/test_tag_models.py | 12 +- .../test_anti_spyware_profile_models.py | 4 +- .../test_dns_security_profiles_models.py | 2 +- .../security/test_security_rules_models.py | 2 +- ...vulnerability_protection_profile_models.py | 2 +- .../test_wildfire_antivirus_profiles.py | 4 +- 48 files changed, 702 insertions(+), 690 deletions(-) diff --git a/README.md b/README.md index a92de943..7aecd190 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ address_data = { "name": "test123", "fqdn": "test123.example.com", "description": "Created via pan-scm-sdk", - "folder": "Prisma Access", + "folder": "Texas", } # Create the address in Strata Cloud Manager diff --git a/docs/about/getting-started.md b/docs/about/getting-started.md index 4db99979..5b74534e 100644 --- a/docs/about/getting-started.md +++ b/docs/about/getting-started.md @@ -72,7 +72,7 @@ address_data = { "name": "test-address", "fqdn": "test.example.com", "description": "Created via pan-scm-sdk", - "folder": "Prisma Access", + "folder": "Texas", } new_address = address.create(address_data) @@ -103,7 +103,7 @@ address_group_data = { "name": "example-group", "description": "Test address group", "static": ["test-address"], - "folder": "Prisma Access", + "folder": "Texas", } new_group = address_group.create(address_group_data) @@ -138,7 +138,7 @@ application_data = { "risk": 1, "description": "Created via pan-scm-sdk", "ports": ["tcp/80,443"], - "folder": "Prisma Access", + "folder": "Texas", } new_application = application.create(application_data) diff --git a/docs/sdk/client.md b/docs/sdk/client.md index fd71dadf..7965c04b 100644 --- a/docs/sdk/client.md +++ b/docs/sdk/client.md @@ -159,8 +159,8 @@ client = Scm( ```python # List addresses with parameters response = client.get( - endpoint="/v1/objects/addresses", - params={"folder": "Shared", "limit": 100} + endpoint="/config/objects/v1/addresses", + params={"folder": "Texas", "limit": 100} ) ``` @@ -176,11 +176,11 @@ response = client.get( # Create a new address object new_address = { "name": "example-address", - "folder": "Shared", + "folder": "Texas", "ip_netmask": "192.168.1.0/24" } response = client.post( - endpoint="/v1/objects/addresses", + endpoint="/config/objects/v1/addresses", json=new_address ) ``` @@ -200,7 +200,7 @@ updated_address = { "ip_netmask": "192.168.2.0/24" } response = client.put( - endpoint="/v1/objects/addresses/example-address", + endpoint="/config/objects/v1/addresses/example-address", json=updated_address ) ``` @@ -216,7 +216,7 @@ response = client.put( ```python # Delete an address object response = client.delete( - endpoint="/v1/objects/addresses/example-address" + endpoint="/config/objects/v1/addresses/example-address" ) ``` @@ -254,16 +254,16 @@ def perform_api_operations(): # Perform API operations try: # List addresses - addresses = client.get("/v1/objects/addresses") + addresses = client.get("/config/objects/v1/addresses") print(f"Found {len(addresses)} addresses") # Create new address new_address = { "name": "test-address", - "folder": "Shared", + "folder": "Texas", "ip_netmask": "192.168.1.0/24" } - created = client.post("/v1/objects/addresses", json=new_address) + created = client.post("/config/objects/v1/addresses", json=new_address) print(f"Created address: {created['name']}") except AuthenticationError as e: @@ -332,12 +332,12 @@ client = Scm( # Reuse for multiple operations -def get_address(name: str): - return client.get(f"/v1/objects/addresses/{name}") +def get_address(object_uuid: str): + return client.get(f"/config/objects/v1/addresses/{object_uuid}") def create_address(address_data: dict): - return client.post("/v1/objects/addresses", json=address_data) + return client.post("/config/objects/v1/addresses", json=address_data) ``` @@ -368,7 +368,7 @@ with scm_client_session( client_secret="your_client_secret", tsg_id="your_tsg_id" ) as client: - addresses = client.get("/v1/objects/addresses") + addresses = client.get("/config/objects/v1/addresses") ``` diff --git a/docs/sdk/config/objects/service_group.md b/docs/sdk/config/objects/service_group.md index bcad0228..d45da6d4 100644 --- a/docs/sdk/config/objects/service_group.md +++ b/docs/sdk/config/objects/service_group.md @@ -74,8 +74,7 @@ service_groups = ServiceGroup(client) try: group_data = { "name": "web-services", - "description": "Web service group", - "services": ["HTTP", "HTTPS"], + "members": ["HTTP", "HTTPS"], "folder": "Texas", "tag": ["Python", "Automation"] } @@ -105,7 +104,7 @@ try: group_id = "123e4567-e89b-12d3-a456-426655440000" group = service_groups.get(group_id) print(f"Group Name: {group.name}") - print(f"Services: {', '.join(group.services)}") + print(f"Members: {', '.join(group.members)}") except NotFoundError as e: print(f"Group not found: {e.message}") @@ -125,14 +124,13 @@ try: # Fetch returns a Pydantic model web_group = service_groups.fetch(folder='Texas', name='web-services') - # Update the model's description attribute - web_group.description = 'Updated web services group' - web_group.services.append('HTTP-8080') + # Update the model's members + web_group.members.append('HTTP-8080') # Update using the Pydantic model updated_group = service_groups.update(web_group) print(f"Updated group: {updated_group.name}") - print(f"New services: {', '.join(updated_group.services)}") + print(f"New members: {', '.join(updated_group.members)}") except NotFoundError as e: print(f"Group not found: {e.message}") @@ -168,7 +166,7 @@ except ReferenceNotZeroError as e: The `list()` method retrieves multiple service groups with optional filtering. You can filter the results using the following kwargs: -- `values`: List[str] - Filter by service values (e.g., ['HTTP', 'HTTPS']) +- `values`: List[str] - Filter by member values (e.g., ['HTTP', 'HTTPS']) - `tags`: List[str] - Filter by tags (e.g., ['Automation', 'Production'])
@@ -179,7 +177,7 @@ try: # List all groups in a folder groups = service_groups.list(folder="Texas") - # List groups with specific services + # List groups with specific members web_groups = service_groups.list( folder="Texas", values=['HTTP', 'HTTPS'] @@ -194,7 +192,7 @@ try: # Print the results for group in groups: print(f"Name: {group.name}") - print(f"Services: {', '.join(group.services)}") + print(f"Members: {', '.join(group.members)}") except InvalidObjectError as e: print(f"Invalid filter parameters: {e.message}") @@ -218,7 +216,7 @@ try: folder="Texas" ) print(f"Found group: {group.name}") - print(f"Current services: {', '.join(group.services)}") + print(f"Current members: {', '.join(group.members)}") except NotFoundError as e: print(f"Group not found: {e.message}") @@ -262,8 +260,7 @@ try: # Create new service group group_data = { "name": "test-services", - "description": "Test service group", - "services": ["HTTP", "HTTPS", "SSH"], + "members": ["HTTP", "HTTPS", "SSH"], "folder": "Texas", "tag": ["Automation"] } @@ -280,12 +277,11 @@ try: print(f"Found group: {fetched_group.name}") # Update the group using Pydantic model - fetched_group.description = "Updated test services" - fetched_group.services.append("FTP") + fetched_group.members.append("FTP") updated_group = service_groups.update(fetched_group) print(f"Updated group: {updated_group.name}") - print(f"New services: {', '.join(updated_group.services)}") + print(f"New members: {', '.join(updated_group.members)}") except NotFoundError as e: print(f"Group not found: {e.message}") diff --git a/docs/sdk/config/security_services/decryption_profile.md b/docs/sdk/config/security_services/decryption_profile.md index 8eca8358..5bee7471 100644 --- a/docs/sdk/config/security_services/decryption_profile.md +++ b/docs/sdk/config/security_services/decryption_profile.md @@ -115,7 +115,7 @@ except InvalidObjectError as e: try: inbound_proxy = { "name": "inbound-proxy", - "folder": "Shared", + "folder": "Texas", "ssl_inbound_proxy": { "block_if_no_resource": True, "block_unsupported_cipher": True, diff --git a/docs/sdk/config/security_services/index.md b/docs/sdk/config/security_services/index.md index 4fc71f3e..4d5c61dd 100644 --- a/docs/sdk/config/security_services/index.md +++ b/docs/sdk/config/security_services/index.md @@ -107,7 +107,7 @@ security_rule = SecurityRule(api_client) # Define your intended object as a Python dictionary sec_rule_dictionary = { "name": "test123", - "folder": "Prisma Access", + "folder": "Texas", "etc": "etc.." } # Perform operations diff --git a/docs/sdk/config/security_services/security_rule.md b/docs/sdk/config/security_services/security_rule.md index 99f9c269..391e6494 100644 --- a/docs/sdk/config/security_services/security_rule.md +++ b/docs/sdk/config/security_services/security_rule.md @@ -78,7 +78,7 @@ security_rule = SecurityRule(client) try: rule_data = { "name": "allow-web", - "folder": "Shared", + "folder": "Texas", "from_": ["trust"], "to": ["untrust"], "source": ["any"], @@ -111,7 +111,7 @@ except InvalidObjectError as e: try: rule_data = { "name": "secure-web", - "folder": "Shared", + "folder": "Texas", "from_": ["trust"], "to": ["untrust"], "source": ["internal-subnet"], @@ -173,7 +173,7 @@ try: # First fetch the existing rule as a Pydantic model fetched_rule = security_rule.fetch( name="allow-web", - folder="Shared", + folder="Texas", rulebase="pre" ) @@ -275,27 +275,27 @@ following kwargs: try: # List all rules in a folder's pre-rulebase rules = security_rule.list( - folder="Shared", + folder="Texas", rulebase="pre" ) # List only allow rules allow_rules = security_rule.list( - folder="Shared", + folder="Texas", rulebase="pre", action=['allow'] ) # List rules with specific applications web_rules = security_rule.list( - folder="Shared", + folder="Texas", rulebase="pre", application=['web-browsing', 'ssl'] ) # List rules with specific zones zone_rules = security_rule.list( - folder="Shared", + folder="Texas", rulebase="pre", from_=['trust'], to_=['untrust'] @@ -303,14 +303,14 @@ try: # List rules with security profiles secure_rules = security_rule.list( - folder="Shared", + folder="Texas", rulebase="pre", profile_setting=['strict-security'] ) # Combine multiple filters filtered_rules = security_rule.list( - folder="Shared", + folder="Texas", rulebase="pre", action=['allow'], application=['web-browsing'], @@ -344,7 +344,7 @@ The `fetch()` method retrieves a single security rule by name from a specific co try: rule = security_rule.fetch( name="allow-web", - folder="Shared", + folder="Texas", rulebase="pre" ) @@ -395,7 +395,7 @@ try: create_data = { "name": "test-web-access", "description": "Test web access rule", - "folder": "Shared", + "folder": "Texas", "from_": ["trust"], "to": ["untrust"], "source": ["internal-net"], @@ -423,7 +423,7 @@ try: try: fetched_rule = security_rule.fetch( name="test-web-access", - folder="Shared", + folder="Texas", rulebase="pre" ) print(f"Found rule: {fetched_rule.name}") diff --git a/docs/sdk/config/security_services/vulnerability_protection_profile.md b/docs/sdk/config/security_services/vulnerability_protection_profile.md index 90ab06b1..1bebb3b6 100644 --- a/docs/sdk/config/security_services/vulnerability_protection_profile.md +++ b/docs/sdk/config/security_services/vulnerability_protection_profile.md @@ -79,7 +79,7 @@ try: profile_data = { "name": "basic-profile", "description": "Basic vulnerability protection", - "folder": "Shared", + "folder": "Texas", "rules": [ { "name": "critical-vulns", @@ -114,7 +114,7 @@ try: profile_data = { "name": "advanced-profile", "description": "Advanced vulnerability protection", - "folder": "Shared", + "folder": "Texas", "rules": [ { "name": "critical-cves", @@ -180,7 +180,7 @@ try: # First fetch the existing profile profile = vulnerability_protection_profile.fetch( name="test-profile", - folder="Shared" + folder="Texas" ) # Update the profile attributes using Pydantic model @@ -240,24 +240,24 @@ results using the following kwargs: try: # List all profiles in a folder profiles = vulnerability_protection_profile.list( - folder="Shared" + folder="Texas" ) # List profiles with critical severity rules critical_profiles = vulnerability_protection_profile.list( - folder="Shared", + folder="Texas", severity=['critical'] ) # List profiles with specific actions alert_profiles = vulnerability_protection_profile.list( - folder="Shared", + folder="Texas", action=['alert', 'block'] ) # List profiles with specific threat names threat_profiles = vulnerability_protection_profile.list( - folder="Shared", + folder="Texas", threat_name=['Log4Shell', 'SQLi'] ) @@ -288,7 +288,7 @@ Pydantic model. try: profile = vulnerability_protection_profile.fetch( name="basic-profile", - folder="Shared" + folder="Texas" ) print(f"Found profile: {profile.name}") @@ -339,7 +339,7 @@ try: create_data = { "name": "test-profile", "description": "Test vulnerability protection", - "folder": "Shared", + "folder": "Texas", "rules": [ { "name": "test-rule", @@ -357,7 +357,7 @@ try: try: fetched_profile = vulnerability_protection_profile.fetch( name="test-profile", - folder="Shared" + folder="Texas" ) print(f"Found profile: {fetched_profile.name}") diff --git a/docs/sdk/config/security_services/wildfire_antivirus.md b/docs/sdk/config/security_services/wildfire_antivirus.md index 5fad3515..c8b3fd9a 100644 --- a/docs/sdk/config/security_services/wildfire_antivirus.md +++ b/docs/sdk/config/security_services/wildfire_antivirus.md @@ -80,7 +80,7 @@ try: profile_data = { "name": "basic-profile", "description": "Basic WildFire profile", - "folder": "Shared", + "folder": "Texas", "rules": [ { "name": "basic-rule", @@ -116,7 +116,7 @@ try: profile_data = { "name": "advanced-profile", "description": "Advanced WildFire profile", - "folder": "Shared", + "folder": "Texas", "packet_capture": True, "rules": [ { @@ -191,7 +191,7 @@ try: # First fetch the existing profile profile = wildfire_antivirus_profile.fetch( name="basic-profile", - folder="Shared" + folder="Texas" ) # Update the profile attributes using Pydantic model @@ -248,12 +248,12 @@ using the following kwargs: try: # List all profiles in a folder profiles = wildfire_antivirus_profile.list( - folder="Shared" + folder="Texas" ) # List profiles with specific rules rule_profiles = wildfire_antivirus_profile.list( - folder="Shared", + folder="Texas", rules=['basic-rule', 'upload-rule'] ) @@ -287,7 +287,7 @@ Pydantic model. try: profile = wildfire_antivirus_profile.fetch( name="basic-profile", - folder="Shared" + folder="Texas" ) print(f"Found profile: {profile.name}") @@ -338,7 +338,7 @@ try: create_data = { "name": "test-profile", "description": "Test WildFire profile", - "folder": "Shared", + "folder": "Texas", "rules": [ { "name": "test-rule", @@ -357,7 +357,7 @@ try: try: fetched_profile = wildfire_antivirus_profile.fetch( name="test-profile", - folder="Shared" + folder="Texas" ) print(f"Found profile: {fetched_profile.name}") diff --git a/docs/sdk/models/objects/address_group_models.md b/docs/sdk/models/objects/address_group_models.md index 67b1464e..2d4dc198 100644 --- a/docs/sdk/models/objects/address_group_models.md +++ b/docs/sdk/models/objects/address_group_models.md @@ -55,7 +55,7 @@ try: name="invalid-group", static=["addr1"], dynamic={"filter": "'tag1'"}, - folder="Shared" + folder="Texas" ) except ValueError as e: print(e) # "Exactly one of 'static' or 'dynamic' must be provided." @@ -64,7 +64,7 @@ except ValueError as e: try: group = AddressGroupCreateModel( name="invalid-group", - folder="Shared" + folder="Texas" ) except ValueError as e: print(e) # "Exactly one of 'static' or 'dynamic' must be provided." @@ -86,7 +86,7 @@ try: group = AddressGroupCreateModel( name="invalid-group", static=["addr1"], - folder="Shared", + folder="Texas", device="fw01" # Can't specify both folder and device ) except ValueError as e: @@ -109,7 +109,7 @@ try: group = AddressGroupCreateModel( name="invalid-group", static=["addr1"], - folder="Shared", + folder="Texas", tag=["web", "web"] # Duplicate tags not allowed ) except ValueError as e: @@ -119,7 +119,7 @@ except ValueError as e: group = AddressGroupCreateModel( name="valid-group", static=["addr1"], - folder="Shared", + folder="Texas", tag="web" # Will be converted to ["web"] ) ``` @@ -142,7 +142,7 @@ static_group_dict = { "name": "web-servers", "description": "Web server group", "static": ["web1", "web2", "web3"], - "folder": "Shared", + "folder": "Texas", "tag": ["web", "production"] } @@ -156,7 +156,7 @@ static_group = AddressGroupCreateModel( name="web-servers", description="Web server group", static=["web1", "web2", "web3"], - folder="Shared", + folder="Texas", tag=["web", "production"] ) diff --git a/docs/sdk/models/objects/address_models.md b/docs/sdk/models/objects/address_models.md index 222270d8..2eb449f0 100644 --- a/docs/sdk/models/objects/address_models.md +++ b/docs/sdk/models/objects/address_models.md @@ -59,7 +59,7 @@ try: name="invalid-address", ip_netmask="192.168.1.0/24", fqdn="example.com", - folder="Shared" + folder="Texas" ) except ValueError as e: print(e) # "Exactly one of 'ip_netmask', 'ip_range', 'ip_wildcard', or 'fqdn' must be provided." @@ -68,7 +68,7 @@ except ValueError as e: try: address = AddressCreateModel( name="invalid-address", - folder="Shared" + folder="Texas" ) except ValueError as e: print(e) # "Value error, Exactly one of 'ip_netmask', 'ip_range', 'ip_wildcard', or 'fqdn' must be provided." @@ -90,7 +90,7 @@ try: address = AddressCreateModel( name="invalid-address", ip_netmask="192.168.1.0/24", - folder="Shared", + folder="Texas", device="fw01" # Can't specify both folder and device ) except ValueError as e: @@ -113,7 +113,7 @@ try: address = AddressCreateModel( name="invalid-address", ip_netmask="192.168.1.0/24", - folder="Shared", + folder="Texas", tag=["web", "web"] # Duplicate tags not allowed ) except ValueError as e: @@ -123,7 +123,7 @@ except ValueError as e: address = AddressCreateModel( name="valid-address", ip_netmask="192.168.1.0/24", - folder="Shared", + folder="Texas", tag="web" # Will be converted to ["web"] ) ``` @@ -146,7 +146,7 @@ address_dict = { "name": "web-server", "description": "Primary web server", "ip_netmask": "192.168.1.100/32", - "folder": "Shared", + "folder": "Texas", "tag": ["web", "production"] } @@ -160,7 +160,7 @@ address_obj = AddressCreateModel( name="web-server", description="Primary web server", ip_netmask="192.168.1.100/32", - folder="Shared", + folder="Texas", tag=["web", "production"] ) @@ -182,7 +182,7 @@ fqdn_dict = { "name": "example-domain", "description": "Example domain address", "fqdn": "www.example.com", - "folder": "Shared", + "folder": "Texas", "tag": ["web", "domain"] } @@ -195,7 +195,7 @@ fqdn_address = AddressCreateModel( name="example-domain", description="Example domain address", fqdn="www.example.com", - folder="Shared", + folder="Texas", tag=["web", "domain"] ) diff --git a/docs/sdk/models/objects/application_group_models.md b/docs/sdk/models/objects/application_group_models.md index 76adea51..ce55b4a7 100644 --- a/docs/sdk/models/objects/application_group_models.md +++ b/docs/sdk/models/objects/application_group_models.md @@ -50,7 +50,7 @@ try: app_group_dict = { "name": "invalid-group", "members": ["app1", "app2"], - "folder": "Shared", + "folder": "Texas", "device": "fw01" # Can't specify both folder and device } app_group = ApplicationGroup(api_client) @@ -88,7 +88,7 @@ from scm.config.objects import ApplicationGroup app_group_dict = { "name": "web-apps", "members": ["http", "https", "web-browsing"], - "folder": "Shared", + "folder": "Texas", } app_group = ApplicationGroup(api_client) @@ -100,7 +100,7 @@ from scm.models.objects import ApplicationGroupCreateModel app_group = ApplicationGroupCreateModel( name="web-apps", members=["http", "https", "web-browsing"], - folder="Shared" + folder="Texas" ) payload = app_group.model_dump(exclude_unset=True) diff --git a/docs/sdk/models/objects/application_models.md b/docs/sdk/models/objects/application_models.md index 997c72df..48fb466a 100644 --- a/docs/sdk/models/objects/application_models.md +++ b/docs/sdk/models/objects/application_models.md @@ -69,7 +69,7 @@ try: "subcategory": "database", "technology": "client-server", "risk": 3, - "folder": "Shared", + "folder": "Texas", "snippet": "Config" # Can't specify both folder and snippet } app = Application(api_client) @@ -113,7 +113,7 @@ app_dict = { "subcategory": "database", "technology": "client-server", "risk": 3, - "folder": "Custom Apps", + "folder": "Texas", "ports": ["tcp/1433"] } @@ -153,7 +153,7 @@ app_dict = { "subcategory": "file-sharing", "technology": "peer-to-peer", "risk": 4, - "folder": "Shared", + "folder": "Texas", "description": "Custom file sharing application", "ports": ["tcp/6346", "tcp/6347"], "evasive": True, @@ -171,7 +171,7 @@ app = ApplicationCreateModel( subcategory="file-sharing", technology="peer-to-peer", risk=4, - folder="Shared", + folder="Texas", description="Custom file sharing application", ports=["tcp/6346", "tcp/6347"], evasive=True, diff --git a/docs/sdk/models/objects/service_group_models.md b/docs/sdk/models/objects/service_group_models.md index 1f59f86a..804a91a2 100644 --- a/docs/sdk/models/objects/service_group_models.md +++ b/docs/sdk/models/objects/service_group_models.md @@ -3,20 +3,20 @@ ## Overview The Service Group models provide a structured way to manage service groups in Palo Alto Networks' Strata Cloud Manager. -These models support grouping services together and defining them within folders, snippets, or devices. The models -handle validation of inputs and outputs when interacting with the SCM API. +These models support grouping network services together and defining them within folders, snippets, or devices. The +models handle validation of inputs and outputs when interacting with the SCM API. ## Attributes -| Attribute | Type | Required | Default | Description | -|-------------|---------------|----------|---------|------------------------------------------------------------------------------------------| -| name | str | Yes | None | Name of the service group. Max length: 63 chars. Must match pattern: ^[a-zA-Z0-9_ \.-]+$ | -| description | str | No | None | Description of the service group. Max length: 1023 chars | -| tag | List[str] | No | None | List of tags. Each tag max length: 64 chars | -| folder | str | No* | None | Folder where group is defined. Max length: 64 chars | -| snippet | str | No* | None | Snippet where group is defined. Max length: 64 chars | -| device | str | No* | None | Device where group is defined. Max length: 64 chars | -| id | UUID | Yes** | None | UUID of the service group (response only) | +| Attribute | Type | Required | Default | Description | +|-----------|-----------|----------|---------|------------------------------------------------------------------------------------------| +| name | str | Yes | None | Name of the service group. Max length: 63 chars. Must match pattern: ^[a-zA-Z0-9_ \.-]+$ | +| members | List[str] | Yes | None | List of service names. Min length: 1, Max length: 1024 | +| tag | List[str] | No | None | List of tags. Each tag max length: 64 chars | +| folder | str | No* | None | Folder where group is defined. Max length: 64 chars | +| snippet | str | No* | None | Snippet where group is defined. Max length: 64 chars | +| device | str | No* | None | Device where group is defined. Max length: 64 chars | +| id | UUID | Yes** | None | UUID of the service group (response only) | \* Exactly one container type (folder/snippet/device) must be provided \** Only required for response model @@ -28,6 +28,7 @@ The Service Group models can raise the following exceptions during validation: - **ValueError**: Raised in several scenarios: - When multiple container types (folder/snippet/device) are specified - When no container type is specified for create operations + - When members list is empty or exceeds maximum length - When tag values are not unique in a list - When tag input is neither a string nor a list - When name or container fields don't match required patterns @@ -41,14 +42,31 @@ For create operations, exactly one container type must be specified:
- ```python -# This will raise a validation error +# Using dictionary +from scm.config.objects import ServiceGroup + +# Error: multiple containers specified +try: + service_group_dict = { + "name": "invalid-group", + "members": ["service1", "service2"], + "folder": "Texas", + "device": "fw01" # Can't specify both folder and device + } + service_group = ServiceGroup(api_client) + response = service_group.create(service_group_dict) +except ValueError as e: + print(e) # "Exactly one of 'folder', 'snippet', or 'device' must be provided." + +# Using model directly +from scm.models.objects import ServiceGroupCreateModel + +# Error: no container specified try: - group = ServiceGroupCreateModel( + service_group = ServiceGroupCreateModel( name="invalid-group", - folder="Shared", - device="fw01" # Can't specify both folder and device + members=["service1", "service2"] ) except ValueError as e: print(e) # "Exactly one of 'folder', 'snippet', or 'device' must be provided." @@ -63,22 +81,23 @@ Tags must be unique and properly formatted:
- ```python # This will raise a validation error for duplicate tags try: - group = ServiceGroupCreateModel( + service_group = ServiceGroupCreateModel( name="invalid-group", - folder="Shared", + members=["service1"], + folder="Texas", tag=["web", "web"] # Duplicate tags not allowed ) except ValueError as e: print(e) # "List items must be unique" # This will convert a single string tag to a list -group = ServiceGroupCreateModel( +service_group = ServiceGroupCreateModel( name="valid-group", - folder="Shared", + members=["service1"], + folder="Texas", tag="web" # Will be converted to ["web"] ) ``` @@ -92,15 +111,14 @@ group = ServiceGroupCreateModel(
- ```python # Using dictionary from scm.config.objects import ServiceGroup service_group_dict = { "name": "web-services", - "description": "Web service group", - "folder": "Shared", + "members": ["http", "https", "web-browsing"], + "folder": "Texas", "tag": ["web", "production"] } @@ -112,8 +130,8 @@ from scm.models.objects import ServiceGroupCreateModel service_group = ServiceGroupCreateModel( name="web-services", - description="Web service group", - folder="Shared", + members=["http", "https", "web-browsing"], + folder="Texas", tag=["web", "production"] ) @@ -128,12 +146,11 @@ response = service_group.create(payload)
- ```python # Using dictionary snippet_group_dict = { "name": "database-services", - "description": "Database service group", + "members": ["mysql", "postgresql", "mongodb"], "snippet": "Database Config", "tag": ["database", "internal"] } @@ -143,7 +160,7 @@ response = service_group.create(snippet_group_dict) # Using model directly snippet_group = ServiceGroupCreateModel( name="database-services", - description="Database service group", + members=["mysql", "postgresql", "mongodb"], snippet="Database Config", tag=["database", "internal"] ) @@ -159,13 +176,12 @@ response = service_group.create(payload)
- ```python # Using dictionary update_dict = { "id": "123e4567-e89b-12d3-a456-426655440000", "name": "web-services-updated", - "description": "Updated web service group", + "members": ["http", "https", "web-browsing", "ssl"], "tag": ["web", "production", "updated"] } @@ -176,8 +192,8 @@ from scm.models.objects import ServiceGroupUpdateModel update_group = ServiceGroupUpdateModel( id="123e4567-e89b-12d3-a456-426655440000", - name="web-services-updated", - description="Updated web service group", + name="web-services-updated", + members=["http", "https", "web-browsing", "ssl"], tag=["web", "production", "updated"] ) diff --git a/docs/sdk/models/objects/service_models.md b/docs/sdk/models/objects/service_models.md index 49d6df23..40f95a5f 100644 --- a/docs/sdk/models/objects/service_models.md +++ b/docs/sdk/models/objects/service_models.md @@ -68,7 +68,7 @@ try: "tcp": {"port": "80"}, "udp": {"port": "53"} # Can't specify both TCP and UDP }, - "folder": "Shared" + "folder": "Texas" } service = Service(api_client) response = service.create(service_dict) @@ -83,7 +83,7 @@ try: service = ServiceCreateModel( name="invalid-service", protocol=Protocol(), - folder="Shared" + folder="Texas" ) except ValueError as e: print(e) # "Exactly one of 'tcp' or 'udp' must be provided in 'protocol'." @@ -105,7 +105,7 @@ try: service_dict = { "name": "invalid-service", "protocol": {"tcp": {"port": "80"}}, - "folder": "Shared", + "folder": "Texas", "device": "fw01" # Can't specify both folder and device } response = service.create(service_dict) @@ -117,7 +117,7 @@ try: service = ServiceCreateModel( name="invalid-service", protocol=Protocol(tcp=TCPProtocol(port="80")), - folder="Shared", + folder="Texas", device="fw01" ) except ValueError as e: @@ -150,7 +150,7 @@ tcp_dict = { } }, "description": "Web service ports", - "folder": "Shared", + "folder": "Texas", "tag": ["web", "production"] } @@ -172,7 +172,7 @@ tcp_service = ServiceCreateModel( ) ), description="Web service ports", - folder="Shared", + folder="Texas", tag=["web", "production"] ) diff --git a/docs/sdk/models/objects/tag_models.md b/docs/sdk/models/objects/tag_models.md index f5588077..54be44af 100644 --- a/docs/sdk/models/objects/tag_models.md +++ b/docs/sdk/models/objects/tag_models.md @@ -52,7 +52,7 @@ from scm.config.objects import Tag try: tag_dict = { "name": "invalid-tag", - "folder": "Shared", + "folder": "Texas", "device": "fw01" # Can't specify both folder and device } tag = Tag(api_client) @@ -66,7 +66,7 @@ from scm.models.objects import TagCreateModel try: tag = TagCreateModel( name="invalid-tag", - folder="Shared", + folder="Texas", device="fw01" ) except ValueError as e: @@ -88,7 +88,7 @@ Colors must be one of the predefined values: try: tag_dict = { "name": "invalid-tag", - "folder": "Shared", + "folder": "Texas", "color": "Invalid Color" # Must be a valid color name } response = tag.create(tag_dict) @@ -99,7 +99,7 @@ except ValueError as e: try: tag = TagCreateModel( name="invalid-tag", - folder="Shared", + folder="Texas", color="Invalid Color" ) except ValueError as e: @@ -122,7 +122,7 @@ tag_dict = { "name": "production", "color": "Red", "comments": "Production environment resources", - "folder": "Shared" + "folder": "Texas" } tag = Tag(api_client) @@ -135,7 +135,7 @@ tag = TagCreateModel( name="production", color="Red", comments="Production environment resources", - folder="Shared" + folder="Texas" ) payload = tag.model_dump(exclude_unset=True) diff --git a/docs/sdk/models/security_services/anti_spyware_profile_models.md b/docs/sdk/models/security_services/anti_spyware_profile_models.md index 32288c7f..0b93226f 100644 --- a/docs/sdk/models/security_services/anti_spyware_profile_models.md +++ b/docs/sdk/models/security_services/anti_spyware_profile_models.md @@ -58,7 +58,7 @@ For create operations, exactly one container type must be specified: try: profile = AntiSpywareProfileCreateModel( name="invalid-profile", - folder="Shared", + folder="Texas", device="fw01", # Can't specify both folder and device rules=[{ "name": "rule1", @@ -95,7 +95,7 @@ try: } profile_dict = { "name": "test-profile", - "folder": "Shared", + "folder": "Texas", "rules": [rule_dict] } response = profile.create(profile_dict) @@ -132,7 +132,7 @@ except ValueError as e: basic_dict = { "name": "basic-profile", "description": "Basic anti-spyware profile", - "folder": "Shared", + "folder": "Texas", "rules": [{ "name": "basic-rule", "severity": ["critical", "high"], @@ -156,7 +156,7 @@ from scm.models.security import ( basic_profile = AntiSpywareProfileCreateModel( name="basic-profile", description="Basic anti-spyware profile", - folder="Shared", + folder="Texas", rules=[ RuleRequest( name="basic-rule", @@ -183,7 +183,7 @@ response = profile.create(payload) # Using dictionary advanced_dict = { "name": "advanced-profile", - "folder": "Security", + "folder": "Texas", "cloud_inline_analysis": True, "rules": [{ "name": "strict-rule", diff --git a/docs/sdk/models/security_services/decryption_profile_models.md b/docs/sdk/models/security_services/decryption_profile_models.md index 6feb8681..1ee8c374 100644 --- a/docs/sdk/models/security_services/decryption_profile_models.md +++ b/docs/sdk/models/security_services/decryption_profile_models.md @@ -52,7 +52,7 @@ The SSL protocol settings enforce that max_version cannot be less than min_versi try: profile_dict = { "name": "invalid-profile", - "folder": "Shared", + "folder": "Texas", "ssl_protocol_settings": { "min_version": "tls1-2", "max_version": "tls1-1" # Invalid: max < min @@ -92,7 +92,7 @@ from scm.config.security import DecryptionProfile try: profile_dict = { "name": "invalid-profile", - "folder": "Shared", + "folder": "Texas", "device": "fw01", # Can't specify both folder and device "ssl_protocol_settings": { "min_version": "tls1-2", @@ -119,7 +119,7 @@ except ValueError as e: # Using dictionary profile_dict = { "name": "basic-profile", - "folder": "Shared", + "folder": "Texas", "ssl_protocol_settings": { "min_version": "tls1-2", "max_version": "tls1-3", @@ -140,7 +140,7 @@ from scm.models.security import ( profile = DecryptionProfileCreateModel( name="basic-profile", - folder="Shared", + folder="Texas", ssl_protocol_settings=SSLProtocolSettings( min_version=SSLVersion.tls1_2, max_version=SSLVersion.tls1_3, @@ -165,7 +165,7 @@ response = profile.create(payload) # Using dictionary forward_proxy_dict = { "name": "forward-proxy-profile", - "folder": "Shared", + "folder": "Texas", "ssl_forward_proxy": { "auto_include_altname": True, "block_expired_certificate": True, @@ -190,7 +190,7 @@ from scm.models.security import ( forward_proxy = DecryptionProfileCreateModel( name="forward-proxy-profile", - folder="Shared", + folder="Texas", ssl_forward_proxy=SSLForwardProxy( auto_include_altname=True, block_expired_certificate=True, diff --git a/docs/sdk/models/security_services/dns_security_profile_models.md b/docs/sdk/models/security_services/dns_security_profile_models.md index 2b206a93..b79a50a1 100644 --- a/docs/sdk/models/security_services/dns_security_profile_models.md +++ b/docs/sdk/models/security_services/dns_security_profile_models.md @@ -61,7 +61,7 @@ For create operations, exactly one container type must be specified: try: profile_dict = { "name": "invalid-profile", - "folder": "Shared", + "folder": "Texas", "device": "fw01" # Can't specify both folder and device } profile = DNSSecurityProfile(api_client) @@ -75,7 +75,7 @@ from scm.models.security import DNSSecurityProfileCreateModel try: profile = DNSSecurityProfileCreateModel( name="invalid-profile", - folder="Shared", + folder="Texas", device="fw01" # Can't specify both folder and device ) except ValueError as e: @@ -104,7 +104,7 @@ try: } profile_dict = { "name": "test-profile", - "folder": "Shared", + "folder": "Texas", "botnet_domains": { "lists": [list_dict] } @@ -142,7 +142,7 @@ from scm.config.security import DNSSecurityProfile profile_dict = { "name": "basic-profile", "description": "Basic DNS security profile", - "folder": "Shared", + "folder": "Texas", "botnet_domains": { "dns_security_categories": [ { @@ -169,7 +169,7 @@ from scm.models.security import ( profile = DNSSecurityProfileCreateModel( name="basic-profile", description="Basic DNS security profile", - folder="Shared", + folder="Texas", botnet_domains=BotnetDomainsModel( dns_security_categories=[ DNSSecurityCategoryEntryModel( @@ -198,7 +198,7 @@ response = profile.create(payload) profile_dict = { "name": "advanced-profile", "description": "Advanced DNS security profile", - "folder": "Shared", + "folder": "Texas", "botnet_domains": { "lists": [ { @@ -230,7 +230,7 @@ from scm.models.security import ( profile = DNSSecurityProfileCreateModel( name="advanced-profile", description="Advanced DNS security profile", - folder="Shared", + folder="Texas", botnet_domains=BotnetDomainsModel( lists=[ ListEntryBaseModel( diff --git a/docs/sdk/models/security_services/security_rule_models.md b/docs/sdk/models/security_services/security_rule_models.md index 119c7c8c..e65f1ca7 100644 --- a/docs/sdk/models/security_services/security_rule_models.md +++ b/docs/sdk/models/security_services/security_rule_models.md @@ -75,7 +75,7 @@ from scm.config.security import SecurityRule try: rule_dict = { "name": "invalid-rule", - "folder": "Shared", + "folder": "Texas", "device": "fw01", # Can't specify both folder and device "action": "allow" } @@ -112,7 +112,7 @@ All list fields are validated to ensure they contain only unique string values: try: rule_dict = { "name": "invalid-rule", - "folder": "Shared", + "folder": "Texas", "source": ["10.0.0.0/8", "10.0.0.0/8"], # Duplicate values not allowed "action": "allow" } @@ -124,7 +124,7 @@ except ValueError as e: try: rule = SecurityRuleCreateModel( name="invalid-rule", - folder="Shared", + folder="Texas", source=["10.0.0.0/8", "10.0.0.0/8"] ) except ValueError as e: @@ -146,7 +146,7 @@ except ValueError as e: rule_dict = { "name": "allow-web", "description": "Allow web traffic", - "folder": "Shared", + "folder": "Texas", "from_": ["trust"], "to_": ["untrust"], "source": ["10.0.0.0/8"], @@ -163,7 +163,7 @@ response = security_rule.create(rule_dict) rule = SecurityRuleCreateModel( name="allow-web", description="Allow web traffic", - folder="Shared", + folder="Texas", from_=["trust"], to_=["untrust"], source=["10.0.0.0/8"], @@ -190,7 +190,7 @@ response = security_rule.create(payload) # Using dictionary rule_dict = { "name": "secure-web", - "folder": "Shared", + "folder": "Texas", "from_": ["trust"], "to_": ["untrust"], "source": ["10.0.0.0/8"], @@ -212,7 +212,7 @@ from scm.models.security import SecurityRuleCreateModel, SecurityRuleProfileSett rule = SecurityRuleCreateModel( name="secure-web", - folder="Shared", + folder="Texas", from_=["trust"], to_=["untrust"], source=["10.0.0.0/8"], diff --git a/docs/sdk/models/security_services/vulnerability_protection_profile_models.md b/docs/sdk/models/security_services/vulnerability_protection_profile_models.md index 637db938..6076114e 100644 --- a/docs/sdk/models/security_services/vulnerability_protection_profile_models.md +++ b/docs/sdk/models/security_services/vulnerability_protection_profile_models.md @@ -63,7 +63,7 @@ try: "name": "rule1", "action": {"alert": {}} }], - "folder": "Shared", + "folder": "Texas", "device": "fw01" # Can't specify both folder and device } profile = VulnerabilityProtectionProfile(api_client) @@ -87,7 +87,7 @@ Actions must be properly formatted and validated: try: profile_dict = { "name": "test-profile", - "folder": "Shared", + "folder": "Texas", "rules": [{ "name": "rule1", "action": ["alert"] # Must be string or dict @@ -101,7 +101,7 @@ except ValueError as e: try: profile_dict = { "name": "test-profile", - "folder": "Shared", + "folder": "Texas", "rules": [{ "name": "rule1", "action": { @@ -130,7 +130,7 @@ except ValueError as e: basic_dict = { "name": "basic-profile", "description": "Basic vulnerability protection profile", - "folder": "Shared", + "folder": "Texas", "rules": [{ "name": "rule1", "action": {"alert": {}}, @@ -154,7 +154,7 @@ from scm.models.security import ( basic_profile = VulnerabilityProfileCreateModel( name="basic-profile", description="Basic vulnerability protection profile", - folder="Shared", + folder="Texas", rules=[ VulnerabilityProfileRuleModel( name="rule1", @@ -182,7 +182,7 @@ response = profile.create(payload) advanced_dict = { "name": "advanced-profile", "description": "Profile with threat exceptions", - "folder": "Shared", + "folder": "Texas", "rules": [{ "name": "rule1", "action": { @@ -224,7 +224,7 @@ from scm.models.security import ( advanced_profile = VulnerabilityProfileCreateModel( name="advanced-profile", description="Profile with threat exceptions", - folder="Shared", + folder="Texas", rules=[ VulnerabilityProfileRuleModel( name="rule1", diff --git a/docs/sdk/models/security_services/wildfire_antivirus_profile_models.md b/docs/sdk/models/security_services/wildfire_antivirus_profile_models.md index d24616f3..17fe8001 100644 --- a/docs/sdk/models/security_services/wildfire_antivirus_profile_models.md +++ b/docs/sdk/models/security_services/wildfire_antivirus_profile_models.md @@ -59,7 +59,7 @@ try: "name": "rule1", "direction": "both" }], - "folder": "Shared", + "folder": "Texas", "device": "fw01" # Can't specify both folder and device } profile = WildfireAntivirusProfile(api_client) @@ -105,7 +105,7 @@ try: "name": "rule1", "direction": "both" }], - folder="Shared" + folder="Texas" ) except ValueError as e: print(e) # "Invalid UUID format for 'id'" @@ -128,7 +128,7 @@ from scm.config.security import WildfireAntivirusProfile profile_dict = { "name": "basic-profile", "description": "Basic WildFire profile", - "folder": "Shared", + "folder": "Texas", "packet_capture": True, "rules": [{ "name": "rule1", @@ -153,7 +153,7 @@ from scm.models.security.wildfire_antivirus_profiles import ( profile = WildfireAvProfileCreateModel( name="basic-profile", description="Basic WildFire profile", - folder="Shared", + folder="Texas", packet_capture=True, rules=[ WildfireAvRuleBase( @@ -183,7 +183,7 @@ response = profile.create(payload) profile_dict = { "name": "advanced-profile", "description": "Profile with exceptions", - "folder": "Shared", + "folder": "Texas", "packet_capture": True, "rules": [{ "name": "rule1", @@ -218,7 +218,7 @@ from scm.models.security.wildfire_antivirus_profiles import ( profile = WildfireAvProfileCreateModel( name="advanced-profile", description="Profile with exceptions", - folder="Shared", + folder="Texas", packet_capture=True, rules=[ WildfireAvRuleBase( diff --git a/scm/models/objects/service.py b/scm/models/objects/service.py index 70443acc..2e71a1f0 100644 --- a/scm/models/objects/service.py +++ b/scm/models/objects/service.py @@ -121,7 +121,7 @@ class ServiceBaseModel(BaseModel): pattern=r"^[a-zA-Z\d\-_. ]+$", max_length=64, description="The folder where the service is defined.", - examples=["Shared"], + examples=["Texas"], ) snippet: Optional[str] = Field( None, diff --git a/tests/factories.py b/tests/factories.py index ba8bbf44..f363e3ca 100644 --- a/tests/factories.py +++ b/tests/factories.py @@ -128,7 +128,7 @@ class Meta: name = factory.Sequence(lambda n: f"address_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" tag = [ "test-tag", "environment-prod", @@ -217,7 +217,7 @@ class Meta: name = factory.Sequence(lambda n: f"address_{n}") description = factory.Faker("sentence") tag = ["response-tag"] - folder = "Shared" + folder = "Texas" # Address types default to None ip_netmask = None @@ -276,7 +276,7 @@ def build_without_type(cls): """Return a data dict without the required address type fields.""" return cls( name="Test123", - folder="Shared", + folder="Texas", # No address type fields provided ) @@ -285,7 +285,7 @@ def build_with_multiple_types(cls): """Return a data dict multiple type fields.""" return cls( name="Test123", - folder="Shared", + folder="Texas", ip_netmask="1.1.1.1/32", fqdn="example.com", ) @@ -303,7 +303,7 @@ def build_with_multiple_containers(cls): """Return a data dict multiple containers.""" return cls( name="Test123", - folder="Shared", + folder="Texas", snippet="this will fail", fqdn="example.com", ) @@ -325,7 +325,7 @@ class AddressUpdateModelFactory(factory.DictFactory): name = factory.Sequence(lambda n: f"address_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" tag = [ "test-tag", "environment-prod", @@ -338,7 +338,7 @@ def build_without_type(cls): """Return a data dict without the required address type fields.""" return cls( name="Test123", - folder="Shared", + folder="Texas", # No address type fields provided ) @@ -347,7 +347,7 @@ def build_with_multiple_types(cls): """Return a data dict multiple type fields.""" return cls( name="Test123", - folder="Shared", + folder="Texas", ip_netmask="1.1.1.1/32", fqdn="example.com", ) @@ -365,7 +365,7 @@ def build_with_multiple_containers(cls): """Return a data dict multiple containers.""" return cls( name="Test123", - folder="Shared", + folder="Texas", snippet="this will fail", fqdn="example.com", ) @@ -405,7 +405,7 @@ class Meta: name = factory.Sequence(lambda n: f"address_group_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" tag = ["test-tag", "environment-prod"] # Address group types default to None @@ -491,7 +491,7 @@ class Meta: id = factory.LazyFunction(lambda: str(uuid.uuid4())) name = factory.Sequence(lambda n: f"address_group_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" tag = ["response-tag"] # Address group types default to None @@ -537,7 +537,7 @@ class AddressGroupCreateModelFactory(factory.DictFactory): name = factory.Sequence(lambda n: f"address_group_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" tag = ["test-tag", "environment-prod"] # Group type fields default to None @@ -549,7 +549,7 @@ def build_without_type(cls): """Return a data dict without the required group type fields.""" return cls( name="TestAddressGroup", - folder="Shared", + folder="Texas", # No group type fields provided ) @@ -558,7 +558,7 @@ def build_with_multiple_types(cls): """Return a data dict with multiple type fields.""" return cls( name="TestAddressGroup", - folder="Shared", + folder="Texas", static=["address1", "address2"], dynamic={"filter": "'tag1 and tag2'"}, ) @@ -577,7 +577,7 @@ def build_with_multiple_containers(cls): """Return a data dict with multiple containers.""" return cls( name="TestAddressGroup", - folder="Shared", + folder="Texas", snippet="this will fail", static=["address1", "address2"], ) @@ -588,7 +588,7 @@ def build_valid_static(cls): return cls( name="TestAddressGroup", static=["address1", "address2"], - folder="Shared", + folder="Texas", tag=["Python", "Automation"], description="This is a test static address group", ) @@ -599,7 +599,7 @@ def build_valid_dynamic(cls): return cls( name="TestAddressGroup", dynamic={"filter": "'tag1 and tag2'"}, - folder="Shared", + folder="Texas", tag=["Python", "Automation"], description="This is a test dynamic address group", ) @@ -623,7 +623,7 @@ def build_without_type(cls): return cls( id="12345678-1234-5678-1234-567812345678", name="TestAddressGroup", - folder="Shared", + folder="Texas", # No group type fields provided ) @@ -633,7 +633,7 @@ def build_with_multiple_types(cls): return cls( id="12345678-1234-5678-1234-567812345678", name="TestAddressGroup", - folder="Shared", + folder="Texas", static=["address1", "address2"], dynamic={"filter": "'tag1 and tag2'"}, ) @@ -645,7 +645,7 @@ def build_valid_static(cls): id="12345678-1234-5678-1234-567812345678", name="TestAddressGroup", static=["address1", "address2"], - folder="Shared", + folder="Texas", tag=["Python", "Automation"], description="This is a test static address group", ) @@ -657,7 +657,7 @@ def build_valid_dynamic(cls): id="12345678-1234-5678-1234-567812345678", name="TestAddressGroup", dynamic={"filter": "'tag1 and tag2'"}, - folder="Shared", + folder="Texas", tag=["Python", "Automation"], description="This is a test dynamic address group", ) @@ -905,7 +905,7 @@ class Meta: "office365-consumer-access", "office365-enterprise-access", ] - folder = "Shared" + folder = "Texas" snippet = None device = None @@ -974,7 +974,7 @@ class Meta: "office365-consumer-access", "office365-enterprise-access", ] - folder = "Shared" + folder = "Texas" snippet = None device = None @@ -1011,7 +1011,7 @@ class ApplicationGroupCreateModelFactory(factory.DictFactory): "office365-consumer-access", "office365-enterprise-access", ] - folder = "Shared" + folder = "Texas" snippet = None device = None @@ -1021,7 +1021,7 @@ def build_valid(cls): return cls( name="TestApplicationGroup", members=["app1", "app2"], - folder="Shared", + folder="Texas", ) @classmethod @@ -1030,7 +1030,7 @@ def build_with_invalid_name(cls): return cls( name="@invalid-name#", members=["app1"], - folder="Shared", + folder="Texas", ) @classmethod @@ -1039,7 +1039,7 @@ def build_with_empty_members(cls): return cls( name="TestGroup", members=[], - folder="Shared", + folder="Texas", ) @classmethod @@ -1057,7 +1057,7 @@ def build_with_multiple_containers(cls): return cls( name="TestGroup", members=["app1"], - folder="Shared", + folder="Texas", snippet="TestSnippet", ) @@ -1158,7 +1158,7 @@ class Meta: name = factory.Sequence(lambda n: f"service_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" snippet = None device = None tag = ["test-tag", "environment-prod"] @@ -1208,7 +1208,7 @@ def build_with_no_containers(cls, **kwargs): @classmethod def build_with_multiple_containers(cls, **kwargs): """Return an instance with multiple containers (should fail validation).""" - return cls(folder="Shared", snippet="TestSnippet", device=None, **kwargs) + return cls(folder="Texas", snippet="TestSnippet", device=None, **kwargs) class ServiceUpdateApiFactory(factory.Factory): @@ -1257,7 +1257,7 @@ def build_with_no_containers(cls, **kwargs): @classmethod def build_with_multiple_containers(cls, **kwargs): """Return an instance with multiple containers.""" - return cls(folder="Shared", snippet="TestSnippet", device=None, **kwargs) + return cls(folder="Texas", snippet="TestSnippet", device=None, **kwargs) class ServiceResponseFactory(factory.Factory): @@ -1269,7 +1269,7 @@ class Meta: id = factory.LazyFunction(lambda: str(uuid.uuid4())) name = factory.Sequence(lambda n: f"service_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" snippet = None device = None tag = ["response-tag"] @@ -1331,7 +1331,7 @@ class ServiceCreateModelFactory(factory.DictFactory): name = factory.Sequence(lambda n: f"service_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" snippet = None device = None tag = ["test-tag", "environment-prod"] @@ -1362,7 +1362,7 @@ def build_with_no_containers(cls, **kwargs): def build_with_multiple_containers(cls, **kwargs): """Return a data dict with multiple containers.""" return cls( - folder="Shared", + folder="Texas", snippet="TestSnippet", protocol={"tcp": {"port": "80,443"}}, device=None, @@ -1413,7 +1413,7 @@ def build_with_no_containers(cls, **kwargs): @classmethod def build_with_multiple_containers(cls, **kwargs): """Return a data dict with multiple containers.""" - return cls(folder="Shared", snippet="TestSnippet", device=None, **kwargs) + return cls(folder="Texas", snippet="TestSnippet", device=None, **kwargs) @classmethod def build_valid(cls, **kwargs): @@ -1502,7 +1502,7 @@ def build_with_no_containers(cls, **kwargs): def build_with_multiple_containers(cls, **kwargs): """Return an instance with multiple containers (should fail validation).""" return cls( - folder="Shared", + folder="Texas", snippet="TestSnippet", device=None, members=["test1", "test1"], @@ -1586,7 +1586,7 @@ def build_with_no_containers(cls, **kwargs): def build_with_multiple_containers(cls, **kwargs): """Return an instance with multiple containers (should fail validation).""" return cls( - folder="Shared", + folder="Texas", snippet="TestSnippet", device=None, members=["test1", "test1"], @@ -1670,7 +1670,7 @@ def build_with_no_containers(cls, **kwargs): def build_with_multiple_containers(cls, **kwargs): """Return an instance with multiple containers (should fail validation).""" return cls( - folder="Shared", + folder="Texas", snippet="TestSnippet", device=None, members=["test1", "test1"], @@ -1720,7 +1720,7 @@ def build_with_no_containers(cls, **kwargs): def build_with_multiple_containers(cls, **kwargs): """Return a data dict with multiple containers.""" return cls( - folder="Shared", + folder="Texas", snippet="TestSnippet", device=None, members=["test1", "test1"], @@ -1770,7 +1770,7 @@ def build_with_no_containers(cls, **kwargs): def build_with_multiple_containers(cls, **kwargs): """Return a data dict with multiple containers.""" return cls( - folder="Shared", + folder="Texas", snippet="TestSnippet", device=None, members=["test1", "test1"], @@ -1801,12 +1801,12 @@ class Meta: name = factory.Sequence(lambda n: f"tag_{n}") comments = factory.Faker("sentence") color = None # Default to None; can be set using with_color() - folder = "Shared" + folder = "Texas" snippet = None device = None @classmethod - def with_folder(cls, folder="Shared", **kwargs): + def with_folder(cls, folder="Texas", **kwargs): """Create a tag with a specific folder.""" return cls(folder=folder, snippet=None, device=None, **kwargs) @@ -1853,12 +1853,12 @@ class Meta: name = factory.Sequence(lambda n: f"tag_{n}") comments = factory.Faker("sentence") color = None - folder = "Shared" + folder = "Texas" snippet = None device = None @classmethod - def with_folder(cls, folder="Shared", **kwargs): + def with_folder(cls, folder="Texas", **kwargs): """Create a response model with a specific folder.""" return cls(folder=folder, snippet=None, device=None, **kwargs) @@ -1893,7 +1893,7 @@ class TagCreateModelFactory(factory.DictFactory): name = factory.Sequence(lambda n: f"tag_{n}") comments = factory.Faker("sentence") color = "Red" # Default color; can be overridden - folder = "Shared" + folder = "Texas" snippet = None device = None @@ -1914,7 +1914,7 @@ def build_with_invalid_color(cls): name="InvalidColorTag", comments="This tag has an invalid color", color="InvalidColor", - folder="Shared", + folder="Texas", ) @classmethod @@ -1922,7 +1922,7 @@ def build_with_multiple_containers(cls): """Return a data dict with multiple containers (should fail validation).""" return cls( name="TestTag", - folder="Shared", + folder="Texas", snippet="MySnippet", color="Blue", ) @@ -2059,7 +2059,7 @@ class Meta: name = factory.Sequence(lambda n: f"profile_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" cloud_inline_analysis = False rules = factory.LazyAttribute(lambda _: [AntiSpywareRuleBaseFactory()]) threat_exception = factory.LazyAttribute( @@ -2127,7 +2127,7 @@ class Meta: id = factory.LazyFunction(lambda: str(uuid.uuid4())) name = factory.Sequence(lambda n: f"profile_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" cloud_inline_analysis = False rules = factory.List([factory.SubFactory(AntiSpywareRuleBaseFactory)]) threat_exception = factory.List( @@ -2159,7 +2159,7 @@ class AntiSpywareProfileCreateModelFactory(factory.DictFactory): name = factory.Sequence(lambda n: f"profile_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" cloud_inline_analysis = False rules = [] @@ -2168,7 +2168,7 @@ def build_valid(cls): """Return a data dict with invalid name pattern.""" return cls( name="valid-profile-name", - folder="Shared", + folder="Texas", rules=[ { "name": "TestRule", @@ -2183,7 +2183,7 @@ def build_with_multiple_containers(cls): """Return a data dict with invalid name pattern.""" return cls( name="valid-profile-name", - folder="Shared", + folder="Texas", snippet="test123", rules=[ { @@ -2199,7 +2199,7 @@ def build_with_invalid_name(cls): """Return a data dict with invalid name pattern.""" return cls( name="@invalid-profile-name", - folder="Shared", + folder="Texas", rules=[ { "name": "TestRule", @@ -2214,7 +2214,7 @@ def build_with_invalid_rules(cls): """Return a data dict with invalid rules structure.""" return cls( name="TestProfile", - folder="Shared", + folder="Texas", rules=[ { "name": "TestRule", @@ -2229,7 +2229,7 @@ def build_with_invalid_exceptions(cls): """Return a data dict with invalid threat exceptions.""" return cls( name="TestProfile", - folder="Shared", + folder="Texas", rules=[], threat_exception=[ { @@ -2253,7 +2253,7 @@ def build_valid(cls): """Return a data dict with invalid name pattern.""" return cls( name="valid-profile-name", - folder="Shared", + folder="Texas", rules=[ { "name": "TestRule", @@ -2401,7 +2401,7 @@ class Meta: model = DecryptionProfileCreateModel name = factory.Sequence(lambda n: f"decryption_profile_{n}") - folder = "Shared" + folder = "Texas" ssl_protocol_settings = factory.SubFactory(SSLProtocolSettingsFactory) ssl_forward_proxy = factory.SubFactory(SSLForwardProxyFactory) ssl_inbound_proxy = factory.SubFactory(SSLInboundProxyFactory) @@ -2466,7 +2466,7 @@ class Meta: id = factory.LazyFunction(lambda: str(uuid.uuid4())) name = factory.Sequence(lambda n: f"decryption_profile_{n}") - folder = "Shared" + folder = "Texas" ssl_protocol_settings = factory.SubFactory(SSLProtocolSettingsFactory) ssl_forward_proxy = factory.SubFactory(SSLForwardProxyFactory) ssl_inbound_proxy = factory.SubFactory(SSLInboundProxyFactory) @@ -2496,14 +2496,14 @@ class DecryptionProfileCreateModelFactory(factory.DictFactory): """Factory for creating data dicts for DecryptionProfileCreateModel validation testing.""" name = factory.Sequence(lambda n: f"decryption_profile_{n}") - folder = "Shared" + folder = "Texas" @classmethod def build_valid(cls): """Return a valid data dict with all expected attributes.""" return cls( name="TestProfile", - folder="Shared", + folder="Texas", ssl_protocol_settings={ "min_version": "tls1-0", "max_version": "tls1-2", @@ -2515,7 +2515,7 @@ def build_with_invalid_name(cls): """Return a data dict with invalid name pattern.""" return cls( name="@invalid-name#", - folder="Shared", + folder="Texas", ) @classmethod @@ -2523,7 +2523,7 @@ def build_with_invalid_ssl_versions(cls): """Return a data dict with invalid SSL version configuration.""" return cls( name="TestProfile", - folder="Shared", + folder="Texas", ssl_protocol_settings={ "min_version": "tls1-2", "max_version": "tls1-0", # Invalid: max < min @@ -2535,7 +2535,7 @@ def build_with_multiple_containers(cls): """Return a data dict with multiple containers.""" return cls( name="TestProfile", - folder="Shared", + folder="Texas", snippet="TestSnippet", ) @@ -2621,7 +2621,7 @@ class Meta: name = factory.Sequence(lambda n: f"security_rule_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" disabled = False tag = ["test-tag", "environment-prod"] @@ -2730,7 +2730,7 @@ class Meta: id = factory.LazyFunction(lambda: str(uuid.uuid4())) name = factory.Sequence(lambda n: f"security_rule_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" tag = ["response-tag"] # Default lists @@ -2816,7 +2816,7 @@ class SecurityRuleCreateModelFactory(factory.DictFactory): name = factory.Sequence(lambda n: f"security_rule_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" tag = ["test-tag"] action = "allow" @@ -2825,7 +2825,7 @@ def build_valid(cls): """Return a valid data dict with all expected attributes.""" return cls( name="TestRule", - folder="Shared", + folder="Texas", action="allow", from_=["trust"], to_=["untrust"], @@ -2838,7 +2838,7 @@ def build_with_invalid_name(cls): """Return a data dict with invalid name pattern.""" return cls( name="@invalid-name#", - folder="Shared", + folder="Texas", action="allow", ) @@ -2847,7 +2847,7 @@ def build_with_invalid_action(cls): """Return a data dict with invalid action.""" return cls( name="TestRule", - folder="Shared", + folder="Texas", action="invalid-action", ) @@ -2856,7 +2856,7 @@ def build_with_duplicate_items(cls): """Return a data dict with duplicate list items.""" return cls( name="TestRule", - folder="Shared", + folder="Texas", source=["any", "any"], tag=["tag1", "tag1"], ) @@ -3053,7 +3053,7 @@ class Meta: name = factory.Sequence(lambda n: f"dns_security_profile_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" botnet_domains = factory.SubFactory(BotnetDomainsFactory) snippet = None device = None @@ -3105,7 +3105,7 @@ class Meta: id = factory.LazyFunction(lambda: str(uuid.uuid4())) name = factory.Sequence(lambda n: f"dns_security_profile_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" botnet_domains = factory.SubFactory(BotnetDomainsFactory) snippet = None device = None @@ -3135,14 +3135,14 @@ class DNSSecurityProfileCreateModelFactory(factory.DictFactory): name = factory.Sequence(lambda n: f"dns_security_profile_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" @classmethod def build_valid(cls): """Return a valid data dict with all expected attributes.""" return cls( name="TestProfile", - folder="Shared", + folder="Texas", botnet_domains={ "dns_security_categories": [ {"name": "malware", "action": "block", "log_level": "high"} @@ -3155,7 +3155,7 @@ def build_with_invalid_name(cls): """Return a data dict with invalid name pattern.""" return cls( name="@invalid-name#", - folder="Shared", + folder="Texas", ) @classmethod @@ -3163,7 +3163,7 @@ def build_with_multiple_containers(cls): """Return a data dict with multiple containers.""" return cls( name="TestProfile", - folder="Shared", + folder="Texas", snippet="TestSnippet", ) @@ -3172,7 +3172,7 @@ def build_with_invalid_action(cls): """Return a data dict with invalid action in botnet domains.""" return cls( name="TestProfile", - folder="Shared", + folder="Texas", botnet_domains={ "dns_security_categories": [ {"name": "malware", "action": "invalid-action"} @@ -3318,7 +3318,7 @@ class Meta: name = factory.Sequence(lambda n: f"vulnerability_profile_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" rules = factory.List([factory.SubFactory(VulnerabilityProfileRuleModelFactory)]) threat_exception = None @@ -3368,7 +3368,7 @@ class Meta: id = factory.LazyFunction(lambda: str(uuid.uuid4())) name = factory.Sequence(lambda n: f"vulnerability_profile_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" rules = factory.List([factory.SubFactory(VulnerabilityProfileRuleModelFactory)]) threat_exception = factory.List( [factory.SubFactory(VulnerabilityProfileThreatExceptionModelFactory)] @@ -3399,7 +3399,7 @@ class VulnerabilityProfileCreateModelFactory(factory.DictFactory): name = factory.Sequence(lambda n: f"vulnerability_profile_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" rules = [] @classmethod @@ -3407,7 +3407,7 @@ def build_valid(cls): """Return a valid data dict with all expected attributes.""" return cls( name="valid-profile-name", - folder="Shared", + folder="Texas", rules=[ { "name": "TestRule", @@ -3423,7 +3423,7 @@ def build_with_multiple_containers(cls): """Return a data dict with multiple containers.""" return cls( name="valid-profile-name", - folder="Shared", + folder="Texas", snippet="test123", rules=[ { @@ -3440,7 +3440,7 @@ def build_with_invalid_name(cls): """Return a data dict with invalid name pattern.""" return cls( name="@invalid-profile-name", - folder="Shared", + folder="Texas", rules=[ { "name": "TestRule", @@ -3456,7 +3456,7 @@ def build_with_invalid_rules(cls): """Return a data dict with invalid rules structure.""" return cls( name="TestProfile", - folder="Shared", + folder="Texas", rules=[ { "name": "TestRule", @@ -3481,7 +3481,7 @@ def build_valid(cls): """Return a valid data dict for updating a profile.""" return cls( name="valid-profile-name", - folder="Shared", + folder="Texas", rules=[ { "name": "TestRule", @@ -3569,7 +3569,7 @@ class Meta: name = factory.Sequence(lambda n: f"wildfire_profile_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" packet_capture = False rules = factory.List([factory.SubFactory(WildfireAvRuleBaseFactory)]) mlav_exception = factory.List( @@ -3627,7 +3627,7 @@ class Meta: id = factory.LazyFunction(lambda: str(uuid.uuid4())) name = factory.Sequence(lambda n: f"wildfire_profile_{n}") description = factory.Faker("sentence") - folder = "Shared" + folder = "Texas" packet_capture = False rules = factory.List([factory.SubFactory(WildfireAvRuleBaseFactory)]) mlav_exception = factory.List( @@ -3661,7 +3661,7 @@ class WildfireAvProfileCreateModelFactory(factory.DictFactory): """Factory for creating data dicts for WildfireAvProfileCreateModel validation testing.""" name = factory.Sequence(lambda n: f"wildfire_profile_{n}") - folder = "Shared" + folder = "Texas" rules = [] @classmethod @@ -3669,7 +3669,7 @@ def build_valid(cls): """Return a valid data dict with all expected attributes.""" return cls( name="TestWildfireProfile", - folder="Shared", + folder="Texas", rules=[ { "name": "TestRule", @@ -3684,7 +3684,7 @@ def build_with_invalid_name(cls): """Return a data dict with invalid name pattern.""" return cls( name="@invalid-name#", - folder="Shared", + folder="Texas", rules=[ { "name": "TestRule", @@ -3698,7 +3698,7 @@ def build_with_multiple_containers(cls): """Return a data dict with multiple containers.""" return cls( name="TestWildfireProfile", - folder="Shared", + folder="Texas", snippet="TestSnippet", rules=[ { @@ -3726,7 +3726,7 @@ def build_with_invalid_rule(cls): """Return a data dict with an invalid rule.""" return cls( name="TestWildfireProfile", - folder="Shared", + folder="Texas", rules=[ { "name": "TestRule", diff --git a/tests/scm/config/objects/test_address.py b/tests/scm/config/objects/test_address.py index 2ed72906..8e891117 100644 --- a/tests/scm/config/objects/test_address.py +++ b/tests/scm/config/objects/test_address.py @@ -161,13 +161,13 @@ def test_list_filters_valid(self): mock_response = {"data": []} self.mock_scm.get.return_value = mock_response # noqa - self.client.list(folder="Shared", **filters) + self.client.list(folder="Texas", **filters) self.mock_scm.get.assert_called_once_with( # noqa "/config/objects/v1/addresses", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) @@ -178,7 +178,7 @@ def test_list_filters_lists_empty(self): { "id": "123e4567-e89b-12d3-a456-426655440000", "name": "test-address", - "folder": "Shared", + "folder": "Texas", "ip_netmask": "10.0.0.0/24", "tag": ["tag1"], } @@ -188,19 +188,19 @@ def test_list_filters_lists_empty(self): # Empty lists should result in no matches filtered_objects = self.client.list( - folder="Shared", + folder="Texas", types=[], ) assert len(filtered_objects) == 0 filtered_objects = self.client.list( - folder="Shared", + folder="Texas", values=[], ) assert len(filtered_objects) == 0 filtered_objects = self.client.list( - folder="Shared", + folder="Texas", tags=[], ) assert len(filtered_objects) == 0 @@ -213,7 +213,7 @@ def test_list_filters_types(self): { "id": "123e4567-e89b-12d3-a456-426655440000", "name": "test-address", - "folder": "Shared", + "folder": "Texas", "ip_netmask": "10.0.0.0/24", "tag": ["tag1", "tag2"], } @@ -228,7 +228,7 @@ def test_list_filters_types(self): error_type="Invalid Query Parameter", ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared", types="netmask") + self.client.list(folder="Texas", types="netmask") error_response = exc_info.value.response.json() assert ( error_response["_errors"][0]["message"] == "'types' filter must be a list" @@ -246,7 +246,7 @@ def test_list_filters_types(self): error_type="Invalid Query Parameter", ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared", values="10.0.0.0/24") + self.client.list(folder="Texas", values="10.0.0.0/24") error_response = exc_info.value.response.json() assert ( error_response["_errors"][0]["message"] == "'values' filter must be a list" @@ -264,7 +264,7 @@ def test_list_filters_types(self): error_type="Invalid Query Parameter", ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared", tags="tag1") + self.client.list(folder="Texas", tags="tag1") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "'tags' filter must be a list" assert ( @@ -279,7 +279,7 @@ def test_list_filters_types(self): # Test that valid list filters pass validation try: self.client.list( - folder="Shared", + folder="Texas", types=["netmask"], values=["10.0.0.0/24"], tags=["tag1"], @@ -366,21 +366,21 @@ def test_list_filters_combinations(self): { "id": "123e4567-e89b-12d3-a456-426655440000", "name": "test-address1", - "folder": "Shared", + "folder": "Texas", "ip_netmask": "10.0.0.0/24", "tag": ["tag1", "tag2"], }, { "id": "223e4567-e89b-12d3-a456-426655440000", "name": "test-address2", - "folder": "Shared", + "folder": "Texas", "ip_range": "10.0.0.1-10.0.0.10", "tag": ["tag2", "tag3"], }, { "id": "323e4567-e89b-12d3-a456-426655440000", "name": "test-address3", - "folder": "Shared", + "folder": "Texas", "fqdn": "test.example.com", "tag": ["tag1", "tag3"], }, @@ -390,7 +390,7 @@ def test_list_filters_combinations(self): # Test combining types and tags filters filtered_objects = self.client.list( - folder="Shared", + folder="Texas", types=["netmask"], tags=["tag1"], ) @@ -399,7 +399,7 @@ def test_list_filters_combinations(self): # Test combining values and tags filters filtered_objects = self.client.list( - folder="Shared", + folder="Texas", values=["10.0.0.0/24"], tags=["tag2"], ) @@ -408,7 +408,7 @@ def test_list_filters_combinations(self): # Test all filters together filtered_objects = self.client.list( - folder="Shared", + folder="Texas", types=["netmask"], values=["10.0.0.0/24"], tags=["tag1"], @@ -424,7 +424,7 @@ def test_list_response_invalid_format(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert exc_info.value.error_code == "E003" assert exc_info.value.http_status_code == 500 @@ -441,7 +441,7 @@ def test_list_response_invalid_data_field_missing(self): self.mock_scm.get.return_value = {"wrong_field": "value"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -460,7 +460,7 @@ def test_list_response_invalid_data_field_type(self): self.mock_scm.get.return_value = {"data": "not a list"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -477,7 +477,7 @@ def test_list_response_no_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.list(folder="Shared") + self.client.list(folder="Texas") def test_list_server_error(self): """Test generic exception handling in list method.""" @@ -489,7 +489,7 @@ def test_list_server_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "An internal error occurred" assert error_response["_errors"][0]["details"]["errorType"] == "Internal Error" @@ -588,7 +588,7 @@ def test_create_http_error_with_response(self): """Test that HTTPError with response content triggers proper error handling.""" test_data = { "name": "test-address", - "folder": "Shared", + "folder": "Texas", "ip_netmask": "10.0.0.0/24", } @@ -628,7 +628,7 @@ def test_get_valid_object(self): id="b44a8c00-7555-4021-96f0-d59deecd54e8", name="TestAddress", ip_netmask="10.0.0.0/24", - folder="Shared", + folder="Texas", ) self.mock_scm.get.return_value = mock_response.model_dump() # noqa @@ -719,7 +719,7 @@ def test_update_valid_object(self): ip_netmask="10.0.0.0/24", description="Updated description", tag=["tag1", "tag2"], - folder="Shared", + folder="Texas", ) # Create mock response @@ -744,7 +744,7 @@ def test_update_valid_object(self): assert payload["ip_netmask"] == "10.0.0.0/24" assert payload["description"] == "Updated description" assert payload["tag"] == ["tag1", "tag2"] - assert payload["folder"] == "Shared" + assert payload["folder"] == "Texas" # Assert the updated object matches the mock response assert isinstance(updated_object, AddressResponseModel) @@ -761,7 +761,7 @@ def test_update_malformed_command_error(self): update_data = AddressUpdateApiFactory.with_ip_netmask( id="123e4567-e89b-12d3-a456-426655440000", name="test-address", - folder="Shared", + folder="Texas", ip_netmask="10.0.0.0/24", ) @@ -787,7 +787,7 @@ def test_update_object_not_present_error(self): update_data = AddressUpdateApiFactory.with_ip_netmask( id="123e4567-e89b-12d3-a456-426655440000", name="test-address", - folder="Shared", + folder="Texas", ip_netmask="10.0.0.0/24", ) @@ -849,7 +849,7 @@ def test_update_server_error(self): update_data = AddressUpdateApiFactory.with_ip_netmask( id="123e4567-e89b-12d3-a456-426655440000", name="test-address", - folder="Shared", + folder="Texas", ip_netmask="10.0.0.0/24", ) @@ -1022,7 +1022,7 @@ def test_fetch_object_not_present_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="nonexistent", folder="Shared") + self.client.fetch(name="nonexistent", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Object not found" assert ( @@ -1039,7 +1039,7 @@ def test_fetch_empty_name_error(self): ) with pytest.raises(MissingQueryParameterError) as exc_info: - self.client.fetch(name="", folder="Shared") + self.client.fetch(name="", folder="Texas") error_msg = str(exc_info.value) assert '"name" is not allowed to be empty' in error_msg @@ -1073,7 +1073,7 @@ def test_fetch_invalid_response_format_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Invalid response format" assert error_response["_errors"][0]["details"]["errorType"] == "Invalid Object" @@ -1083,7 +1083,7 @@ def test_fetch_generic_exception_handling(self): self.mock_scm.get.side_effect = Exception("Generic error") # noqa with pytest.raises(Exception) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") assert str(exc_info.value) == "Generic error" @@ -1101,7 +1101,7 @@ def test_fetch_http_error_no_response_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.fetch(name="test-address", folder="Shared") + self.client.fetch(name="test-address", folder="Texas") def test_fetch_server_error(self): """Test handling of server errors during fetch.""" @@ -1113,7 +1113,7 @@ def test_fetch_server_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "An internal error occurred" assert error_response["_errors"][0]["details"]["errorType"] == "Internal Error" @@ -1123,14 +1123,14 @@ def test_fetch_missing_id_field_error(self): # Mock response without 'id' field mock_response = { "name": "test-address", - "folder": "Shared", + "folder": "Texas", "ip_netmask": "10.0.0.0/24", } self.mock_scm.get.return_value = mock_response # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test-address", folder="Shared") + self.client.fetch(name="test-address", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg @@ -1152,7 +1152,7 @@ def test_fetch_multiple_containers_provided_error(self): with pytest.raises(InvalidObjectError) as exc_info: self.client.fetch( name="test-address", - folder="Shared", + folder="Texas", snippet="TestSnippet", ) @@ -1167,7 +1167,7 @@ def test_fetch_invalid_response_type_error(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test123", folder="Shared") + self.client.fetch(name="test123", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg diff --git a/tests/scm/config/objects/test_address_group.py b/tests/scm/config/objects/test_address_group.py index 3266e334..699a8336 100644 --- a/tests/scm/config/objects/test_address_group.py +++ b/tests/scm/config/objects/test_address_group.py @@ -56,13 +56,13 @@ def test_list_valid(self): } self.mock_scm.get.return_value = mock_response # noqa - existing_objects = self.client.list(folder="Shared") + existing_objects = self.client.list(folder="Texas") self.mock_scm.get.assert_called_once_with( # noqa "/config/objects/v1/address-groups", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) assert isinstance(existing_objects, list) @@ -127,7 +127,7 @@ def test_list_filters_valid(self): AddressGroupResponseFactory.with_static( id="123e4567-e89b-12d3-a456-426655440000", name="static_group", - folder="Shared", + folder="Texas", static=["address1", "address2"], description="Static address group", tag=["tag1"], @@ -139,13 +139,13 @@ def test_list_filters_valid(self): } self.mock_scm.get.return_value = mock_response # noqa - result = self.client.list(folder="Shared", **filters) + result = self.client.list(folder="Texas", **filters) self.mock_scm.get.assert_called_once_with( # noqa "/config/objects/v1/address-groups", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) assert len(result) == 1 @@ -166,19 +166,19 @@ def test_list_filters_lists_empty(self): # Empty lists should result in no matches filtered_objects = self.client.list( - folder="Shared", + folder="Texas", types=[], ) assert len(filtered_objects) == 0 filtered_objects = self.client.list( - folder="Shared", + folder="Texas", values=[], ) assert len(filtered_objects) == 0 filtered_objects = self.client.list( - folder="Shared", + folder="Texas", tags=[], ) assert len(filtered_objects) == 0 @@ -231,7 +231,7 @@ def test_list_response_invalid_format(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert exc_info.value.error_code == "E003" assert exc_info.value.http_status_code == 500 @@ -242,7 +242,7 @@ def test_list_response_invalid_data_field_missing(self): self.mock_scm.get.return_value = {"wrong_field": "value"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -255,7 +255,7 @@ def test_list_response_invalid_data_field_type(self): self.mock_scm.get.return_value = {"data": "not a list"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -273,7 +273,7 @@ def test_list_response_no_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.list(folder="Shared") + self.client.list(folder="Texas") class TestAddressGroupCreate(TestAddressGroupBase): @@ -331,7 +331,7 @@ def test_create_http_error_with_response(self): """Test that HTTPError with response content triggers proper error handling.""" test_data = { "name": "test-address-group", - "folder": "Shared", + "folder": "Texas", "static": ["address1", "address2"], } @@ -359,7 +359,7 @@ def test_get_valid_object(self): mock_response = AddressGroupResponseFactory.with_static( id="123e4567-e89b-12d3-a456-426655440000", name="test-group", - folder="Shared", + folder="Texas", static=["address1", "address2"], ).model_dump() @@ -422,7 +422,7 @@ def test_update_valid_object(self): name="updated-group", static=["address3", "address4"], description="Updated description", - folder="Shared", + folder="Texas", ) # Create mock response @@ -446,7 +446,7 @@ def test_update_valid_object(self): assert payload["name"] == "updated-group" assert payload["static"] == ["address3", "address4"] assert payload["description"] == "Updated description" - assert payload["folder"] == "Shared" + assert payload["folder"] == "Texas" # Assert the updated object matches the mock response assert isinstance(updated_object, AddressGroupResponseModel) @@ -461,7 +461,7 @@ def test_update_malformed_command_error(self): update_data = AddressGroupUpdateApiFactory.with_static( id="123e4567-e89b-12d3-a456-426655440000", name="test-group", - folder="Shared", + folder="Texas", static=["address1", "address2"], ) @@ -561,7 +561,7 @@ def test_fetch_valid_object(self): mock_response_model = AddressGroupResponseFactory.with_static( id="123e4567-e89b-12d3-a456-426655440000", name="test-group", - folder="Shared", + folder="Texas", static=["address1", "address2"], description="Test address group", ) @@ -595,7 +595,7 @@ def test_fetch_valid_object(self): def test_fetch_empty_name_error(self): """Test fetching with an empty name parameter.""" with pytest.raises(MissingQueryParameterError) as exc_info: - self.client.fetch(name="", folder="Shared") + self.client.fetch(name="", folder="Texas") error_msg = str(exc_info.value) assert ( @@ -627,7 +627,7 @@ def test_fetch_multiple_containers_provided_error(self): with pytest.raises(InvalidObjectError) as exc_info: self.client.fetch( name="test-group", - folder="Shared", + folder="Texas", snippet="TestSnippet", ) @@ -644,7 +644,7 @@ def test_fetch_http_error_no_response_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.fetch(name="test-group", folder="Shared") + self.client.fetch(name="test-group", folder="Texas") def test_fetch_invalid_response_type_error(self): """Test that InvalidObjectError is raised when the response is not a dictionary.""" @@ -652,7 +652,7 @@ def test_fetch_invalid_response_type_error(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test-group", folder="Shared") + self.client.fetch(name="test-group", folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -665,14 +665,14 @@ def test_fetch_missing_id_field_error(self): # Mock response without 'id' field mock_response = { "name": "test-group", - "folder": "Shared", + "folder": "Texas", "static": ["address1", "address2"], } self.mock_scm.get.return_value = mock_response # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test-group", folder="Shared") + self.client.fetch(name="test-group", folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -690,7 +690,7 @@ def test_fetch_error_handler(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test-group", folder="Shared") + self.client.fetch(name="test-group", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "An internal error occurred" assert error_response["_errors"][0]["details"]["errorType"] == "Internal Error" diff --git a/tests/scm/config/objects/test_application.py b/tests/scm/config/objects/test_application.py index ae9132b8..3520f428 100644 --- a/tests/scm/config/objects/test_application.py +++ b/tests/scm/config/objects/test_application.py @@ -76,13 +76,13 @@ def test_list_valid(self): } self.mock_scm.get.return_value = mock_response # noqa - existing_objects = self.client.list(folder="Shared") + existing_objects = self.client.list(folder="Texas") self.mock_scm.get.assert_called_once_with( # noqa "/config/objects/v1/applications", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) assert isinstance(existing_objects, list) @@ -164,13 +164,13 @@ def test_list_filters_valid(self): } self.mock_scm.get.return_value = mock_response # noqa - result = self.client.list(folder="Shared", **filters) + result = self.client.list(folder="Texas", **filters) self.mock_scm.get.assert_called_once_with( # noqa "/config/objects/v1/applications", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) assert len(result) == 1 @@ -197,25 +197,25 @@ def test_list_filters_lists_empty(self): # Empty lists should result in no matches filtered_objects = self.client.list( - folder="Shared", + folder="Texas", category=[], ) assert len(filtered_objects) == 0 filtered_objects = self.client.list( - folder="Shared", + folder="Texas", subcategory=[], ) assert len(filtered_objects) == 0 filtered_objects = self.client.list( - folder="Shared", + folder="Texas", technology=[], ) assert len(filtered_objects) == 0 filtered_objects = self.client.list( - folder="Shared", + folder="Texas", risk=[], ) assert len(filtered_objects) == 0 @@ -261,7 +261,7 @@ def test_list_response_invalid_format(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert exc_info.value.error_code == "E003" assert exc_info.value.http_status_code == 500 @@ -272,7 +272,7 @@ def test_list_response_invalid_data_field_missing(self): self.mock_scm.get.return_value = {"wrong_field": "value"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -285,7 +285,7 @@ def test_list_response_invalid_data_field_type(self): self.mock_scm.get.return_value = {"data": "not a list"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -303,7 +303,7 @@ def test_list_response_no_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.list(folder="Shared") + self.client.list(folder="Texas") class TestApplicationCreate(TestApplicationBase): @@ -357,7 +357,7 @@ def test_create_error_handler(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test-group", folder="Shared") + self.client.fetch(name="test-group", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Error occurred" assert ( @@ -373,7 +373,7 @@ def test_get_valid_object(self): mock_response = ApplicationResponseFactory( id="123e4567-e89b-12d3-a456-426655440000", name="test-app", - folder="Shared", + folder="Texas", category="general-internet", subcategory="file-sharing", technology="peer-to-peer", @@ -589,7 +589,7 @@ def test_fetch_valid_object(self): mock_response_model = ApplicationResponseFactory( id="123e4567-e89b-12d3-a456-426655440000", name="test-app", - folder="Shared", + folder="Texas", category="general-internet", subcategory="file-sharing", technology="peer-to-peer", @@ -629,7 +629,7 @@ def test_fetch_valid_object(self): def test_fetch_empty_name_error(self): """Test fetching with an empty name parameter.""" with pytest.raises(MissingQueryParameterError) as exc_info: - self.client.fetch(name="", folder="Shared") + self.client.fetch(name="", folder="Texas") error_msg = str(exc_info.value) assert ( @@ -661,7 +661,7 @@ def test_fetch_multiple_containers_provided_error(self): with pytest.raises(InvalidObjectError) as exc_info: self.client.fetch( name="test-app", - folder="Shared", + folder="Texas", snippet="TestSnippet", ) @@ -678,14 +678,14 @@ def test_fetch_http_error_no_response_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.fetch(name="test-app", folder="Shared") + self.client.fetch(name="test-app", folder="Texas") def test_fetch_invalid_response_type_error(self): """Test that InvalidObjectError is raised when the response is not a dictionary.""" self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test-app", folder="Shared") + self.client.fetch(name="test-app", folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -716,7 +716,7 @@ def test_fetch_error_handler(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Object not found" assert ( @@ -727,14 +727,14 @@ def test_fetch_missing_id_field_error(self): """Test that InvalidObjectError is raised when the response is missing 'id' field.""" mock_response = { "name": "test-app", - "folder": "Shared", + "folder": "Texas", "category": "general-internet", } self.mock_scm.get.return_value = mock_response # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test-app", folder="Shared") + self.client.fetch(name="test-app", folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) diff --git a/tests/scm/config/objects/test_application_group.py b/tests/scm/config/objects/test_application_group.py index 6bb26945..b6d4086e 100644 --- a/tests/scm/config/objects/test_application_group.py +++ b/tests/scm/config/objects/test_application_group.py @@ -49,7 +49,7 @@ def test_list_valid(self): "data": [ ApplicationGroupResponseFactory( name="Microsoft 365 Access", - folder="Shared", + folder="Texas", members=[ "office365-consumer-access", "office365-enterprise-access", @@ -57,7 +57,7 @@ def test_list_valid(self): ).model_dump(), ApplicationGroupResponseFactory( name="Microsoft 365 Services", - folder="Shared", + folder="Texas", members=["ms-office365", "ms-onedrive"], ).model_dump(), ], @@ -67,13 +67,13 @@ def test_list_valid(self): } self.mock_scm.get.return_value = mock_response # noqa - existing_objects = self.client.list(folder="Shared") + existing_objects = self.client.list(folder="Texas") self.mock_scm.get.assert_called_once_with( # noqa "/config/objects/v1/application-groups", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) assert isinstance(existing_objects, list) @@ -154,13 +154,13 @@ def test_list_filters_valid(self): mock_response = {"data": []} self.mock_scm.get.return_value = mock_response # noqa - self.client.list(folder="Shared", **filters) + self.client.list(folder="Texas", **filters) self.mock_scm.get.assert_called_once_with( # noqa "/config/objects/v1/application-groups", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) @@ -183,7 +183,7 @@ def test_list_filters_lists_empty(self): # Empty lists should result in no matches filtered_objects = self.client.list( - folder="Shared", + folder="Texas", members=[], ) assert len(filtered_objects) == 0 @@ -213,7 +213,7 @@ def test_list_filters_types(self): error_type="Invalid Query Parameter", ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared", types="netmask") + self.client.list(folder="Texas", types="netmask") error_response = exc_info.value.response.json() assert ( error_response["_errors"][0]["message"] == "'members' filter must be a list" @@ -230,7 +230,7 @@ def test_list_filters_types(self): # Test that valid list filters pass validation try: self.client.list( - folder="Shared", + folder="Texas", members=["ssl"], ) except HTTPError: @@ -267,7 +267,7 @@ def test_list_response_invalid_format(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert exc_info.value.error_code == "E003" assert exc_info.value.http_status_code == 500 @@ -284,7 +284,7 @@ def test_list_response_invalid_data_field_missing(self): self.mock_scm.get.return_value = {"wrong_field": "value"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -303,7 +303,7 @@ def test_list_response_invalid_data_field_type(self): self.mock_scm.get.return_value = {"data": "not a list"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -320,7 +320,7 @@ def test_list_response_no_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.list(folder="Shared") + self.client.list(folder="Texas") def test_list_server_error(self): """Test generic exception handling in list method.""" @@ -332,7 +332,7 @@ def test_list_server_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "An internal error occurred" assert error_response["_errors"][0]["details"]["errorType"] == "Internal Error" @@ -380,7 +380,7 @@ def test_create_http_error_with_response(self): """Test that HTTPError with response content triggers proper error handling.""" test_data = { "name": "test-address", - "folder": "Shared", + "folder": "Texas", "members": [ "office365-consumer-access", "office365-enterprise-access", @@ -411,7 +411,7 @@ def test_create_generic_exception_handling(self): self.client.create( { "name": "test-address", - "folder": "Shared", + "folder": "Texas", "members": [ "office365-consumer-access", "office365-enterprise-access", @@ -429,7 +429,7 @@ def test_get_valid_object(self): mock_response = ApplicationGroupResponseFactory( name="TestGroup", members=["app1", "app2"], - folder="Shared", + folder="Texas", ) self.mock_scm.get.return_value = mock_response.model_dump() # noqa @@ -516,7 +516,7 @@ def test_update_valid_object(self): id="123e4567-e89b-12d3-a456-426655440000", name="TestApplicationGroup", members=["tag1", "tag2"], - folder="Shared", + folder="Texas", ) # Create mock response @@ -554,7 +554,7 @@ def test_update_malformed_command_error(self): update_data = ApplicationGroupUpdateApiFactory.with_members( id="123e4567-e89b-12d3-a456-426655440000", name="test-address", - folder="Shared", + folder="Texas", members=["tag1", "tag2"], ) @@ -580,7 +580,7 @@ def test_update_object_not_present_error(self): update_data = ApplicationGroupUpdateApiFactory.with_members( id="123e4567-e89b-12d3-a456-426655440000", name="test-address", - folder="Shared", + folder="Texas", members=["tag1", "tag2"], ) @@ -643,7 +643,7 @@ def test_update_server_error(self): update_data = ApplicationGroupUpdateApiFactory.with_members( id="123e4567-e89b-12d3-a456-426655440000", name="test-address", - folder="Shared", + folder="Texas", members=["test1", "test2"], ) @@ -744,7 +744,7 @@ def test_fetch_valid_object(self): mock_response_model = ApplicationGroupResponseFactory( name="TestGroup", members=["app1", "app2"], - folder="Shared", + folder="Texas", ) mock_response_data = mock_response_model.model_dump() @@ -784,7 +784,7 @@ def test_fetch_object_not_present_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="nonexistent", folder="Shared") + self.client.fetch(name="nonexistent", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Object not found" assert ( @@ -794,7 +794,7 @@ def test_fetch_object_not_present_error(self): def test_fetch_empty_name_error(self): """Test fetching with an empty name parameter.""" with pytest.raises(MissingQueryParameterError): - self.client.fetch(name="", folder="Shared") + self.client.fetch(name="", folder="Texas") def test_fetch_empty_container_error(self): """Test fetching with an empty folder parameter.""" @@ -811,7 +811,7 @@ def test_fetch_invalid_response_format_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Invalid response format" assert error_response["_errors"][0]["details"]["errorType"] == "Invalid Object" @@ -821,7 +821,7 @@ def test_fetch_generic_exception_handling(self): self.mock_scm.get.side_effect = Exception("Generic error") # noqa with pytest.raises(Exception) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") assert str(exc_info.value) == "Generic error" @@ -839,7 +839,7 @@ def test_fetch_http_error_no_response_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.fetch(name="test-address", folder="Shared") + self.client.fetch(name="test-address", folder="Texas") def test_fetch_server_error(self): """Test handling of server errors during fetch.""" @@ -851,7 +851,7 @@ def test_fetch_server_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "An internal error occurred" assert error_response["_errors"][0]["details"]["errorType"] == "Internal Error" @@ -861,14 +861,14 @@ def test_fetch_missing_id_field_error(self): # Mock response without 'id' field mock_response = { "name": "test-address", - "folder": "Shared", + "folder": "Texas", "ip_netmask": "10.0.0.0/24", } self.mock_scm.get.return_value = mock_response # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test-address", folder="Shared") + self.client.fetch(name="test-address", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg @@ -890,7 +890,7 @@ def test_fetch_multiple_containers_provided_error(self): with pytest.raises(InvalidObjectError) as exc_info: self.client.fetch( name="test-address", - folder="Shared", + folder="Texas", snippet="TestSnippet", ) @@ -905,7 +905,7 @@ def test_fetch_invalid_response_type_error(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test123", folder="Shared") + self.client.fetch(name="test123", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg diff --git a/tests/scm/config/objects/test_service.py b/tests/scm/config/objects/test_service.py index 6ee3f292..61b29cdd 100644 --- a/tests/scm/config/objects/test_service.py +++ b/tests/scm/config/objects/test_service.py @@ -70,7 +70,7 @@ def test_list_valid(self): halfclose_timeout=10, timewait_timeout=10, name="Test", - folder="Shared", + folder="Texas", description="This is just a test", ).model_dump(), ] @@ -164,13 +164,13 @@ def test_list_filters_valid(self): mock_response = {"data": []} self.mock_scm.get.return_value = mock_response # noqa - self.client.list(folder="Shared", **filters) + self.client.list(folder="Texas", **filters) self.mock_scm.get.assert_called_once_with( # noqa "/config/objects/v1/services", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) @@ -193,7 +193,7 @@ def test_list_filters_lists_empty(self): { "id": "5e7600f1-8681-4048-973b-4117da7e446c", "name": "Test", - "folder": "Shared", + "folder": "Texas", "protocol": { "tcp": { "port": "4433,4333,4999,9443", @@ -209,7 +209,7 @@ def test_list_filters_lists_empty(self): { "id": "5a3d6182-c5f1-4b1e-8ec9-e984ae5247fb", "name": "Test123UDP", - "folder": "Shared", + "folder": "Texas", "description": "UDP test", "protocol": {"udp": {"port": "5444,5432"}}, "tag": ["Automation"], @@ -223,13 +223,13 @@ def test_list_filters_lists_empty(self): # Empty lists should result in no matches filtered_objects = self.client.list( - folder="Shared", + folder="Texas", protocols=[], ) assert len(filtered_objects) == 0 filtered_objects = self.client.list( - folder="Shared", + folder="Texas", tags=[], ) assert len(filtered_objects) == 0 @@ -254,7 +254,7 @@ def test_list_filters_types(self): { "id": "5e7600f1-8681-4048-973b-4117da7e446c", "name": "Test", - "folder": "Shared", + "folder": "Texas", "protocol": { "tcp": { "port": "4433,4333,4999,9443", @@ -270,7 +270,7 @@ def test_list_filters_types(self): { "id": "5a3d6182-c5f1-4b1e-8ec9-e984ae5247fb", "name": "Test123UDP", - "folder": "Shared", + "folder": "Texas", "description": "UDP test", "protocol": {"udp": {"port": "5444,5432"}}, "tag": ["Automation"], @@ -289,7 +289,7 @@ def test_list_filters_types(self): error_type="Invalid Query Parameter", ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared", protocols="tcp") + self.client.list(folder="Texas", protocols="tcp") error_response = exc_info.value.response.json() assert ( error_response["_errors"][0]["message"] @@ -308,7 +308,7 @@ def test_list_filters_types(self): error_type="Invalid Query Parameter", ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared", tags="automation") + self.client.list(folder="Texas", tags="automation") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "'tags' filter must be a list" assert ( @@ -323,7 +323,7 @@ def test_list_filters_types(self): # Test that valid list filters pass validation try: self.client.list( - folder="Shared", + folder="Texas", tags=["automation"], protocols=["tcp"], ) @@ -422,7 +422,7 @@ def test_list_filters_combinations(self): { "id": "5e7600f1-8681-4048-973b-4117da7e446c", "name": "Test", - "folder": "Shared", + "folder": "Texas", "protocol": { "tcp": { "port": "4433,4333,4999,9443", @@ -438,7 +438,7 @@ def test_list_filters_combinations(self): { "id": "5a3d6182-c5f1-4b1e-8ec9-e984ae5247fb", "name": "Test123UDP", - "folder": "Shared", + "folder": "Texas", "description": "UDP test", "protocol": {"udp": {"port": "5444,5432"}}, "tag": ["Automation"], @@ -467,7 +467,7 @@ def test_list_response_invalid_format(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert exc_info.value.error_code == "E003" assert exc_info.value.http_status_code == 500 @@ -484,7 +484,7 @@ def test_list_response_invalid_data_field_missing(self): self.mock_scm.get.return_value = {"wrong_field": "value"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -503,7 +503,7 @@ def test_list_response_invalid_data_field_type(self): self.mock_scm.get.return_value = {"data": "not a list"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -520,7 +520,7 @@ def test_list_response_no_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.list(folder="Shared") + self.client.list(folder="Texas") def test_list_server_error(self): """Test generic exception handling in list method.""" @@ -532,7 +532,7 @@ def test_list_server_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "An internal error occurred" assert error_response["_errors"][0]["details"]["errorType"] == "Internal Error" @@ -645,7 +645,7 @@ def test_get_valid_object(self): mock_response = ServiceResponseFactory.with_tcp( id="5e7600f1-8681-4048-973b-4117da7e446c", name="Test", - folder="Shared", + folder="Texas", description="This is just a test", port="80,8080", tag=["Automation"], @@ -738,7 +738,7 @@ def test_update_valid_object(self): # Create update data using factory update_data = ServiceUpdateApiFactory.with_tcp( name="UpdatedService", - folder="Shared", + folder="Texas", description="An updated service", port="80,8080", ) @@ -764,7 +764,7 @@ def test_update_valid_object(self): assert payload["name"] == "UpdatedService" assert payload["description"] == "An updated service" assert payload["protocol"]["tcp"]["port"] == "80,8080" - assert payload["folder"] == "Shared" + assert payload["folder"] == "Texas" # Assert the updated object matches the mock response assert isinstance(updated_object, ServiceResponseModel) @@ -779,7 +779,7 @@ def test_update_malformed_command_error(self): update_data = ServiceUpdateApiFactory.with_tcp( id="123e4567-e89b-12d3-a456-426655440000", name="UpdatedService", - folder="Shared", + folder="Texas", description="An updated service", port="80,8080", ) @@ -805,7 +805,7 @@ def test_update_object_not_present_error(self): # Create test data update_data = ServiceResponseFactory.with_tcp( name="UpdatedService", - folder="Shared", + folder="Texas", description="An updated service", port="80,8080", ) @@ -868,7 +868,7 @@ def test_update_server_error(self): update_data = ServiceUpdateApiFactory.with_tcp( id="123e4567-e89b-12d3-a456-426655440000", name="UpdatedService", - folder="Shared", + folder="Texas", description="An updated service", port="80,8080", ) @@ -998,7 +998,7 @@ def test_fetch_valid_object(self): mock_response_model = ServiceResponseFactory.with_tcp( id="123e4567-e89b-12d3-a456-426655440000", name="web-browsing", - folder="Shared", + folder="Texas", port="80,8080", description=None, tag=["web"], @@ -1038,7 +1038,7 @@ def test_fetch_object_not_present_error(self): **Objective:** Test that fetching a non-existent object raises NotFoundError. """ service_name = "NonExistent" - folder_name = "Shared" + folder_name = "Texas" # Configure mock to raise HTTPError with the mock response self.mock_scm.get.side_effect = raise_mock_http_error( # noqa @@ -1069,7 +1069,7 @@ def test_fetch_empty_name_error(self): ) with pytest.raises(MissingQueryParameterError) as exc_info: - self.client.fetch(name="", folder="Shared") + self.client.fetch(name="", folder="Texas") error_msg = str(exc_info.value) assert '"name" is not allowed to be empty' in error_msg @@ -1103,7 +1103,7 @@ def test_fetch_invalid_response_format_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Invalid response format" assert error_response["_errors"][0]["details"]["errorType"] == "Invalid Object" @@ -1113,7 +1113,7 @@ def test_fetch_invalid_response_format_error(self): # self.mock_scm.get.side_effect = Exception("Generic error") # noqa # # with pytest.raises(Exception) as exc_info: - # self.client.fetch(name="test", folder="Shared") + # self.client.fetch(name="test", folder="Texas") # # assert str(exc_info.value) == "Generic error" @@ -1131,7 +1131,7 @@ def test_fetch_http_error_no_response_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.fetch(name="test-address", folder="Shared") + self.client.fetch(name="test-address", folder="Texas") def test_fetch_server_error(self): """Test handling of server errors during fetch.""" @@ -1143,7 +1143,7 @@ def test_fetch_server_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "An internal error occurred" assert error_response["_errors"][0]["details"]["errorType"] == "Internal Error" @@ -1155,7 +1155,7 @@ def test_fetch_response_handling(self): mock_response_model = ServiceResponseFactory.with_tcp_override( id="123e4567-e89b-12d3-a456-426655440000", name="TestService", - folder="Shared", + folder="Texas", port="80", description=None, tag=None, @@ -1192,14 +1192,14 @@ def test_fetch_missing_id_field_error(self): # Mock response without 'id' field mock_response = { "name": "test-address", - "folder": "Shared", + "folder": "Texas", "ip_netmask": "10.0.0.0/24", } self.mock_scm.get.return_value = mock_response # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test-address", folder="Shared") + self.client.fetch(name="test-address", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg @@ -1221,7 +1221,7 @@ def test_fetch_multiple_containers_provided_error(self): with pytest.raises(InvalidObjectError) as exc_info: self.client.fetch( name="test-address", - folder="Shared", + folder="Texas", snippet="TestSnippet", ) @@ -1236,7 +1236,7 @@ def test_fetch_invalid_response_type_error(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test123", folder="Shared") + self.client.fetch(name="test123", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg diff --git a/tests/scm/config/objects/test_service_group.py b/tests/scm/config/objects/test_service_group.py index 5d463133..0882a7dc 100644 --- a/tests/scm/config/objects/test_service_group.py +++ b/tests/scm/config/objects/test_service_group.py @@ -144,13 +144,13 @@ def test_list_filters_valid(self): mock_response = {"data": []} self.mock_scm.get.return_value = mock_response # noqa - self.client.list(folder="Shared", **filters) + self.client.list(folder="Texas", **filters) self.mock_scm.get.assert_called_once_with( # noqa "/config/objects/v1/service-groups", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) @@ -161,7 +161,7 @@ def test_list_filters_lists_empty(self): { "id": "76c6cd9b-78bd-4528-8645-b23c92b08146", "name": "Testasdfasdfsadfasdf", - "folder": "Shared", + "folder": "Texas", "members": ["Test123UDP"], "tag": ["Automation"], } @@ -174,13 +174,13 @@ def test_list_filters_lists_empty(self): # Empty lists should result in no matches filtered_objects = self.client.list( - folder="Shared", + folder="Texas", values=[], ) assert len(filtered_objects) == 0 filtered_objects = self.client.list( - folder="Shared", + folder="Texas", tags=[], ) assert len(filtered_objects) == 0 @@ -193,7 +193,7 @@ def test_list_filters_types(self): { "id": "76c6cd9b-78bd-4528-8645-b23c92b08146", "name": "Testasdfasdfsadfasdf", - "folder": "Shared", + "folder": "Texas", "members": ["Test123UDP"], "tag": ["Automation"], } @@ -211,7 +211,7 @@ def test_list_filters_types(self): error_type="Invalid Query Parameter", ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared", values="Test123UDP") + self.client.list(folder="Texas", values="Test123UDP") error_response = exc_info.value.response.json() assert ( error_response["_errors"][0]["message"] == "'values' filter must be a list" @@ -229,7 +229,7 @@ def test_list_filters_types(self): error_type="Invalid Query Parameter", ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared", tags="automation") + self.client.list(folder="Texas", tags="automation") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "'tags' filter must be a list" assert ( @@ -244,7 +244,7 @@ def test_list_filters_types(self): # Test that valid list filters pass validation try: self.client.list( - folder="Shared", + folder="Texas", tags=["automation"], values=["Test123UDP"], ) @@ -304,7 +304,7 @@ def test_list_filters_combinations(self): { "id": "76c6cd9b-78bd-4528-8645-b23c92b08146", "name": "Testasdfasdfsadfasdf", - "folder": "Shared", + "folder": "Texas", "members": ["Test123UDP"], "tag": ["Automation"], } @@ -333,7 +333,7 @@ def test_list_response_invalid_format(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert exc_info.value.error_code == "E003" assert exc_info.value.http_status_code == 500 @@ -350,7 +350,7 @@ def test_list_response_invalid_data_field_missing(self): self.mock_scm.get.return_value = {"wrong_field": "value"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -369,7 +369,7 @@ def test_list_response_invalid_data_field_type(self): self.mock_scm.get.return_value = {"data": "not a list"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -386,7 +386,7 @@ def test_list_response_no_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.list(folder="Shared") + self.client.list(folder="Texas") def test_list_server_error(self): """Test generic exception handling in list method.""" @@ -398,7 +398,7 @@ def test_list_server_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "An internal error occurred" assert error_response["_errors"][0]["details"]["errorType"] == "Internal Error" @@ -829,7 +829,7 @@ def test_fetch_object_not_present_error(self): **Objective:** Test that fetching a non-existent object raises NotFoundError. """ service_name = "NonExistent" - folder_name = "Shared" + folder_name = "Texas" # Configure mock to raise HTTPError with the mock response self.mock_scm.get.side_effect = raise_mock_http_error( # noqa @@ -860,7 +860,7 @@ def test_fetch_empty_name_error(self): ) with pytest.raises(MissingQueryParameterError) as exc_info: - self.client.fetch(name="", folder="Shared") + self.client.fetch(name="", folder="Texas") error_msg = str(exc_info.value) assert '"name" is not allowed to be empty' in error_msg @@ -894,7 +894,7 @@ def test_fetch_invalid_response_format_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Invalid response format" assert error_response["_errors"][0]["details"]["errorType"] == "Invalid Object" @@ -913,7 +913,7 @@ def test_fetch_http_error_no_response_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.fetch(name="test-address", folder="Shared") + self.client.fetch(name="test-address", folder="Texas") def test_fetch_server_error(self): """Test handling of server errors during fetch.""" @@ -925,7 +925,7 @@ def test_fetch_server_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "An internal error occurred" assert error_response["_errors"][0]["details"]["errorType"] == "Internal Error" @@ -966,14 +966,14 @@ def test_fetch_missing_id_field_error(self): # Mock response without 'id' field mock_response = { "name": "test-address", - "folder": "Shared", + "folder": "Texas", "members": ["test1", "test2"], } self.mock_scm.get.return_value = mock_response # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test-address", folder="Shared") + self.client.fetch(name="test-address", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg @@ -995,7 +995,7 @@ def test_fetch_multiple_containers_provided_error(self): with pytest.raises(InvalidObjectError) as exc_info: self.client.fetch( name="test-address", - folder="Shared", + folder="Texas", snippet="TestSnippet", ) @@ -1010,7 +1010,7 @@ def test_fetch_invalid_response_type_error(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test123", folder="Shared") + self.client.fetch(name="test123", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg diff --git a/tests/scm/config/objects/test_tag.py b/tests/scm/config/objects/test_tag.py index 9d631b85..75182a14 100644 --- a/tests/scm/config/objects/test_tag.py +++ b/tests/scm/config/objects/test_tag.py @@ -50,13 +50,13 @@ def test_list_valid(self): TagResponseFactory.with_color( name="TestTag1", color="Red", - folder="Shared", + folder="Texas", comments="First test tag", ).model_dump(), TagResponseFactory.with_color( name="TestTag2", color="Blue", - folder="Shared", + folder="Texas", comments="Second test tag", ).model_dump(), ], @@ -66,13 +66,13 @@ def test_list_valid(self): } self.mock_scm.get.return_value = mock_response # noqa - existing_tags = self.client.list(folder="Shared") + existing_tags = self.client.list(folder="Texas") self.mock_scm.get.assert_called_once_with( # noqa "/config/objects/v1/tags", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) assert isinstance(existing_tags, list) @@ -92,17 +92,17 @@ def test_list_filters_valid(self): TagResponseFactory.with_color( name="TestTag1", color="Red", - folder="Shared", + folder="Texas", ).model_dump(), TagResponseFactory.with_color( name="TestTag2", color="Blue", - folder="Shared", + folder="Texas", ).model_dump(), TagResponseFactory.with_color( name="TestTag3", color="Green", - folder="Shared", + folder="Texas", ).model_dump(), ], "offset": 0, @@ -112,13 +112,13 @@ def test_list_filters_valid(self): self.mock_scm.get.return_value = mock_response # noqa - filtered_tags = self.client.list(folder="Shared", **filters) + filtered_tags = self.client.list(folder="Texas", **filters) self.mock_scm.get.assert_called_once_with( # noqa "/config/objects/v1/tags", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) @@ -133,7 +133,7 @@ def test_list_filters_invalid_colors_not_list(self): # Don't set up any mock response so validation runs first with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared", **filters) + self.client.list(folder="Texas", **filters) assert exc_info.value.message == "Invalid response format: expected dictionary" assert exc_info.value.error_code == "E003" @@ -148,7 +148,7 @@ def test_list_filters_invalid_colors_type(self): filters = {"colors": "Red"} # String instead of list with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared", **filters) + self.client.list(folder="Texas", **filters) assert exc_info.value.message == "'colors' filter must be a list" assert exc_info.value.http_status_code == 400 @@ -174,7 +174,7 @@ def test_list_container_missing_error(self): def test_list_container_multiple_error(self): """Test validation of container parameters.""" with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared", snippet="TestSnippet") + self.client.list(folder="Texas", snippet="TestSnippet") error_msg = str(exc_info.value) assert "HTTP error: 400 - API error: E003" in error_msg @@ -184,7 +184,7 @@ def test_list_response_invalid_format(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert "HTTP error: 500 - API error: E003" in str(exc_info.value) @@ -193,7 +193,7 @@ def test_list_response_invalid_data_field_missing(self): self.mock_scm.get.return_value = {"wrong_field": "value"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert "HTTP error: 500 - API error: E003" in str(exc_info.value) @@ -202,7 +202,7 @@ def test_list_response_invalid_data_field_type(self): self.mock_scm.get.return_value = {"data": "not a list"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert "HTTP error: 500 - API error: E003" in str(exc_info.value) @@ -216,7 +216,7 @@ def test_list_http_error_no_response_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.list(folder="Shared") + self.client.list(folder="Texas") def test_list_filters_invalid_color_value(self): """Test listing tags with an invalid color value in the 'colors' filter.""" @@ -230,12 +230,12 @@ def test_list_filters_invalid_color_value(self): TagResponseFactory.with_color( name="TestTag1", color="Red", - folder="Shared", + folder="Texas", ).model_dump(), TagResponseFactory.with_color( name="TestTag2", color="Blue", - folder="Shared", + folder="Texas", ).model_dump(), ], "offset": 0, @@ -246,7 +246,7 @@ def test_list_filters_invalid_color_value(self): self.mock_scm.get.return_value = mock_response # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared", **filters) + self.client.list(folder="Texas", **filters) error_msg = exc_info.value.message assert "Invalid color 'InvalidColor'" in error_msg @@ -263,7 +263,7 @@ def test_list_api_error_handling(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Bad Request" assert error_response["_errors"][0]["details"]["errorType"] == "Invalid Request" @@ -274,7 +274,7 @@ class TestTagCreate(TestTagBase): def test_create_valid_tag(self): """Test creating a tag with valid data.""" - test_tag = TagCreateApiFactory.with_color(color="Red", folder="Shared") + test_tag = TagCreateApiFactory.with_color(color="Red", folder="Texas") mock_response = TagResponseFactory.from_request(test_tag) self.mock_scm.post.return_value = mock_response.model_dump() # noqa @@ -302,7 +302,7 @@ def test_create_invalid_color(self): def test_create_multiple_containers(self): """Test creating a tag with multiple containers.""" test_tag_data = TagCreateApiFactory.build().model_dump() - test_tag_data["folder"] = "Shared" + test_tag_data["folder"] = "Texas" test_tag_data["snippet"] = "TestSnippet" with pytest.raises(ValidationError) as exc_info: @@ -336,7 +336,7 @@ def test_create_http_error_no_response_content(self): self.mock_scm.post.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.create({"name": "TestTag", "color": "Red", "folder": "Shared"}) + self.client.create({"name": "TestTag", "color": "Red", "folder": "Texas"}) def test_create_server_error(self): """Test generic exception handling in create method.""" @@ -348,7 +348,7 @@ def test_create_server_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.create({"name": "TestTag", "color": "Red", "folder": "Shared"}) + self.client.create({"name": "TestTag", "color": "Red", "folder": "Texas"}) error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "An internal error occurred" assert error_response["_errors"][0]["details"]["errorType"] == "Internal Error" @@ -363,7 +363,7 @@ def test_get_valid_tag(self): id="123e4567-e89b-12d3-a456-426655440000", name="TestTag", color="Red", - folder="Shared", + folder="Texas", ) self.mock_scm.get.return_value = mock_response.model_dump() # noqa @@ -589,7 +589,7 @@ def test_fetch_valid_object(self): id="123e4567-e89b-12d3-a456-426655440000", name="TestTag", color="Red", - folder="Shared", + folder="Texas", ) mock_response_data = mock_response_model.model_dump() @@ -631,7 +631,7 @@ def test_fetch_tag_not_present_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="NonexistentTag", folder="Shared") + self.client.fetch(name="NonexistentTag", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Tag not found" assert ( @@ -641,7 +641,7 @@ def test_fetch_tag_not_present_error(self): def test_fetch_empty_name_error(self): """Test fetching with an empty name parameter.""" with pytest.raises(MissingQueryParameterError) as exc_info: - self.client.fetch(name="", folder="Shared") + self.client.fetch(name="", folder="Texas") error_msg = str(exc_info.value) assert '"name" is not allowed to be empty' in error_msg @@ -672,7 +672,7 @@ def test_fetch_no_container_provided_error(self): def test_fetch_multiple_containers_provided_error(self): """Test fetching when multiple container parameters are provided.""" with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="TestTag", folder="Shared", snippet="TestSnippet") + self.client.fetch(name="TestTag", folder="Texas", snippet="TestSnippet") error_msg = exc_info.value.message assert ( @@ -685,7 +685,7 @@ def test_fetch_invalid_response_format_error(self): self.mock_scm.get.return_value = {"unexpected": "format"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="TestTag", folder="Shared") + self.client.fetch(name="TestTag", folder="Texas") error_msg = exc_info.value.message assert "Invalid response format: missing 'id' field" in error_msg @@ -700,14 +700,14 @@ def test_fetch_http_error_no_response_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.fetch(name="TestTag", folder="Shared") + self.client.fetch(name="TestTag", folder="Texas") def test_fetch_response_invalid_format(self): """Test fetching when the API returns a response that is not a dictionary.""" self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="TestTag", folder="Shared") + self.client.fetch(name="TestTag", folder="Texas") error_msg = exc_info.value.message assert "Invalid response format: expected dictionary" in error_msg diff --git a/tests/scm/config/security/test_anti_spyware_profile.py b/tests/scm/config/security/test_anti_spyware_profile.py index 0e1a93bb..31d5cba7 100644 --- a/tests/scm/config/security/test_anti_spyware_profile.py +++ b/tests/scm/config/security/test_anti_spyware_profile.py @@ -54,12 +54,12 @@ def test_list_valid(self): "data": [ AntiSpywareProfileResponseFactory( name="profile1", - folder="Shared", + folder="Texas", rules=[AntiSpywareRuleBaseFactory()], ).model_dump(), AntiSpywareProfileResponseFactory( name="profile2", - folder="Shared", + folder="Texas", rules=[AntiSpywareRuleBaseFactory()], ).model_dump(), ], @@ -69,13 +69,13 @@ def test_list_valid(self): } self.mock_scm.get.return_value = mock_response # noqa - existing_objects = self.client.list(folder="Shared") + existing_objects = self.client.list(folder="Texas") self.mock_scm.get.assert_called_once_with( # noqa "/config/security/v1/anti-spyware-profiles", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) assert isinstance(existing_objects, list) @@ -155,13 +155,13 @@ def test_list_filters_valid(self): mock_response = {"data": []} self.mock_scm.get.return_value = mock_response # noqa - self.client.list(folder="Shared", **filters) + self.client.list(folder="Texas", **filters) self.mock_scm.get.assert_called_once_with( # noqa "/config/security/v1/anti-spyware-profiles", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) @@ -228,7 +228,7 @@ def test_list_filters_types(self): error_type="Invalid Query Parameter", ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared", types="netmask") + self.client.list(folder="Texas", types="netmask") error_response = exc_info.value.response.json() assert ( error_response["_errors"][0]["message"] == "'types' filter must be a list" @@ -244,7 +244,7 @@ def test_list_filters_types(self): # Test that valid list filters pass validation try: self.client.list( - folder="Shared", + folder="Texas", rules=["test1"], ) except HTTPError: @@ -284,7 +284,7 @@ def test_list_response_invalid_format(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert exc_info.value.error_code == "E003" assert exc_info.value.http_status_code == 500 @@ -301,7 +301,7 @@ def test_list_response_invalid_data_field_missing(self): self.mock_scm.get.return_value = {"wrong_field": "value"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -320,7 +320,7 @@ def test_list_response_invalid_data_field_type(self): self.mock_scm.get.return_value = {"data": "not a list"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -337,7 +337,7 @@ def test_list_http_error_no_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.list(folder="Shared") + self.client.list(folder="Texas") class TestAntiSpywareProfileCreate(TestAntiSpywareProfileBase): @@ -368,7 +368,7 @@ def test_create_http_error_no_content(self): self.mock_scm.post.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.create({"name": "test", "folder": "Shared", "rules": []}) + self.client.create({"name": "test", "folder": "Texas", "rules": []}) def test_create_with_rules(self): """Test creating profile with specific rules configuration.""" @@ -899,7 +899,7 @@ def test_get_object_not_present_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Object not found" assert ( @@ -994,7 +994,7 @@ def test_fetch_object_not_present_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="nonexistent", folder="Shared") + self.client.fetch(name="nonexistent", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Object not found" assert ( @@ -1011,7 +1011,7 @@ def test_fetch_empty_name_error(self): ) with pytest.raises(MissingQueryParameterError) as exc_info: - self.client.fetch(name="", folder="Shared") + self.client.fetch(name="", folder="Texas") error_msg = str(exc_info.value) assert '"name" is not allowed to be empty' in error_msg @@ -1045,7 +1045,7 @@ def test_fetch_invalid_response_format_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Invalid response format" assert error_response["_errors"][0]["details"]["errorType"] == "Invalid Object" @@ -1055,7 +1055,7 @@ def test_fetch_generic_exception_handling(self): self.mock_scm.get.side_effect = Exception("Generic error") # noqa with pytest.raises(Exception) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") assert str(exc_info.value) == "Generic error" @@ -1073,7 +1073,7 @@ def test_fetch_http_error_no_response_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.fetch(name="test-address", folder="Shared") + self.client.fetch(name="test-address", folder="Texas") def test_fetch_server_error(self): """Test handling of server errors during fetch.""" @@ -1085,7 +1085,7 @@ def test_fetch_server_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "An internal error occurred" assert error_response["_errors"][0]["details"]["errorType"] == "Internal Error" @@ -1095,14 +1095,14 @@ def test_fetch_missing_id_field_error(self): # Mock response without 'id' field mock_response = { "name": "test-address", - "folder": "Shared", + "folder": "Texas", "ip_netmask": "10.0.0.0/24", } self.mock_scm.get.return_value = mock_response # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test-address", folder="Shared") + self.client.fetch(name="test-address", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg @@ -1124,7 +1124,7 @@ def test_fetch_multiple_containers_provided_error(self): with pytest.raises(InvalidObjectError) as exc_info: self.client.fetch( name="test-address", - folder="Shared", + folder="Texas", snippet="TestSnippet", ) @@ -1139,7 +1139,7 @@ def test_fetch_invalid_response_type_error(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test123", folder="Shared") + self.client.fetch(name="test123", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg diff --git a/tests/scm/config/security/test_decryption_profile.py b/tests/scm/config/security/test_decryption_profile.py index 4e356c69..12afdd94 100644 --- a/tests/scm/config/security/test_decryption_profile.py +++ b/tests/scm/config/security/test_decryption_profile.py @@ -54,12 +54,12 @@ def test_list_valid(self): "data": [ DecryptionProfileResponseFactory( name="profile1", - folder="Shared", + folder="Texas", ssl_protocol_settings=SSLProtocolSettingsFactory(), ).model_dump(), DecryptionProfileResponseFactory( name="profile2", - folder="Shared", + folder="Texas", ssl_forward_proxy=SSLForwardProxyFactory(), ).model_dump(), ], @@ -69,13 +69,13 @@ def test_list_valid(self): } self.mock_scm.get.return_value = mock_response # noqa - existing_objects = self.client.list(folder="Shared") + existing_objects = self.client.list(folder="Texas") self.mock_scm.get.assert_called_once_with( # noqa "/config/security/v1/decryption-profiles", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) assert isinstance(existing_objects, list) @@ -131,13 +131,13 @@ def test_list_filters_valid(self): mock_response = {"data": []} self.mock_scm.get.return_value = mock_response # noqa - self.client.list(folder="Shared", **filters) + self.client.list(folder="Texas", **filters) self.mock_scm.get.assert_called_once_with( # noqa "/config/security/v1/decryption-profiles", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) @@ -147,7 +147,7 @@ def test_list_filters_lists_empty(self): "data": [ DecryptionProfileResponseFactory( name="profile1", - folder="Shared", + folder="Texas", ssl_protocol_settings=SSLProtocolSettingsFactory(), ).model_dump() ] @@ -155,7 +155,7 @@ def test_list_filters_lists_empty(self): self.mock_scm.get.return_value = mock_response # noqa filtered_objects = self.client.list( - folder="Shared", + folder="Texas", types=[], ) assert len(filtered_objects) == 0 @@ -177,7 +177,7 @@ def test_list_response_invalid_format(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert exc_info.value.error_code == "E003" assert exc_info.value.http_status_code == 500 @@ -188,7 +188,7 @@ def test_list_response_invalid_data_field_missing(self): self.mock_scm.get.return_value = {"wrong_field": "value"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -201,7 +201,7 @@ def test_list_response_invalid_data_field_type(self): self.mock_scm.get.return_value = {"data": "not a list"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -218,7 +218,7 @@ def test_list_http_error_no_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.list(folder="Shared") + self.client.list(folder="Texas") class TestDecryptionProfileCreate(TestDecryptionProfileBase): @@ -252,7 +252,7 @@ def test_create_http_error_no_content(self): self.client.create( { "name": "test", - "folder": "Shared", + "folder": "Texas", "ssl_protocol_settings": { "min_version": "tls1-0", "max_version": "tls1-2", @@ -280,7 +280,7 @@ def test_create_http_error_with_response(self): """Test that HTTPError with response content triggers proper error handling.""" test_data = { "name": "test-profile", - "folder": "Shared", + "folder": "Texas", "ssl_protocol_settings": { "min_version": "tls1-0", "max_version": "tls1-2", @@ -310,7 +310,7 @@ def test_create_generic_exception_handling(self): self.client.create( { "name": "test-profile", - "folder": "Shared", + "folder": "Texas", "ssl_protocol_settings": { "min_version": "tls1-0", "max_version": "tls1-2", @@ -346,7 +346,7 @@ def test_get_object_not_present_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Object not found" assert ( @@ -679,7 +679,7 @@ def test_fetch_object_not_present_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="nonexistent", folder="Shared") + self.client.fetch(name="nonexistent", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Object not found" assert ( @@ -689,7 +689,7 @@ def test_fetch_object_not_present_error(self): def test_fetch_empty_name_error(self): """Test fetching with an empty name parameter.""" with pytest.raises(MissingQueryParameterError) as exc_info: - self.client.fetch(name="", folder="Shared") + self.client.fetch(name="", folder="Texas") error_msg = str(exc_info.value) assert '"name" is not allowed to be empty' in error_msg @@ -719,7 +719,7 @@ def test_fetch_multiple_containers_provided_error(self): with pytest.raises(InvalidObjectError) as exc_info: self.client.fetch( name="test-profile", - folder="Shared", + folder="Texas", snippet="TestSnippet", ) @@ -736,7 +736,7 @@ def test_fetch_http_error_no_response_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.fetch(name="test-profile", folder="Shared") + self.client.fetch(name="test-profile", folder="Texas") def test_fetch_server_error(self): """Test handling of server errors during fetch.""" @@ -748,7 +748,7 @@ def test_fetch_server_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "An internal error occurred" assert error_response["_errors"][0]["details"]["errorType"] == "Internal Error" @@ -757,7 +757,7 @@ def test_fetch_missing_id_field_error(self): """Test that InvalidObjectError is raised when the response is missing 'id' field.""" mock_response = { "name": "test-profile", - "folder": "Shared", + "folder": "Texas", "ssl_protocol_settings": { "min_version": "tls1-0", "max_version": "tls1-2", @@ -767,7 +767,7 @@ def test_fetch_missing_id_field_error(self): self.mock_scm.get.return_value = mock_response # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test-profile", folder="Shared") + self.client.fetch(name="test-profile", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg @@ -779,7 +779,7 @@ def test_fetch_invalid_response_type_error(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test123", folder="Shared") + self.client.fetch(name="test123", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg diff --git a/tests/scm/config/security/test_dns_security_profile.py b/tests/scm/config/security/test_dns_security_profile.py index 5b559e4f..f800d33c 100644 --- a/tests/scm/config/security/test_dns_security_profile.py +++ b/tests/scm/config/security/test_dns_security_profile.py @@ -56,12 +56,12 @@ def test_list_valid(self): "data": [ DNSSecurityProfileResponseFactory( name="profile1", - folder="Shared", + folder="Texas", botnet_domains=BotnetDomainsFactory(), ).model_dump(), DNSSecurityProfileResponseFactory( name="profile2", - folder="Shared", + folder="Texas", botnet_domains=BotnetDomainsFactory(), ).model_dump(), ], @@ -71,13 +71,13 @@ def test_list_valid(self): } self.mock_scm.get.return_value = mock_response # noqa - existing_objects = self.client.list(folder="Shared") + existing_objects = self.client.list(folder="Texas") self.mock_scm.get.assert_called_once_with( # noqa "/config/security/v1/dns-security-profiles", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) assert isinstance(existing_objects, list) @@ -133,13 +133,13 @@ def test_list_filters_valid(self): mock_response = {"data": []} self.mock_scm.get.return_value = mock_response # noqa - self.client.list(folder="Shared", **filters) + self.client.list(folder="Texas", **filters) self.mock_scm.get.assert_called_once_with( # noqa "/config/security/v1/dns-security-profiles", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) @@ -149,7 +149,7 @@ def test_list_filters_lists_empty(self): "data": [ DNSSecurityProfileResponseFactory( name="profile1", - folder="Shared", + folder="Texas", botnet_domains=BotnetDomainsFactory(), ).model_dump() ] @@ -157,7 +157,7 @@ def test_list_filters_lists_empty(self): self.mock_scm.get.return_value = mock_response # noqa filtered_objects = self.client.list( - folder="Shared", + folder="Texas", dns_security_categories=[], ) assert len(filtered_objects) == 0 @@ -169,7 +169,7 @@ def test_list_filters_types(self): "data": [ DNSSecurityProfileResponseFactory( name="profile1", - folder="Shared", + folder="Texas", botnet_domains=BotnetDomainsFactory(), ).model_dump() ] @@ -183,7 +183,7 @@ def test_list_filters_types(self): error_type="Invalid Query Parameter", ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared", dns_security_categories="netmask") + self.client.list(folder="Texas", dns_security_categories="netmask") error_response = exc_info.value.response.json() assert ( error_response["_errors"][0]["message"] @@ -201,7 +201,7 @@ def test_list_filters_types(self): # Test that valid list filters pass validation try: self.client.list( - folder="Shared", + folder="Texas", types=["netmask"], values=["10.0.0.0/24"], tags=["tag1"], @@ -228,7 +228,7 @@ def test_list_response_invalid_format(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert exc_info.value.error_code == "E003" assert exc_info.value.http_status_code == 500 @@ -239,7 +239,7 @@ def test_list_response_invalid_data_field_missing(self): self.mock_scm.get.return_value = {"wrong_field": "value"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -252,7 +252,7 @@ def test_list_response_invalid_data_field_type(self): self.mock_scm.get.return_value = {"data": "not a list"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -269,7 +269,7 @@ def test_list_http_error_no_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.list(folder="Shared") + self.client.list(folder="Texas") class TestDNSSecurityProfileCreate(TestDNSSecurityProfileBase): @@ -301,7 +301,7 @@ def test_create_http_error_no_content(self): with pytest.raises(HTTPError): self.client.create( - {"name": "test", "folder": "Shared", "botnet_domains": {}} + {"name": "test", "folder": "Texas", "botnet_domains": {}} ) def test_create_with_dns_security_categories(self): @@ -334,7 +334,7 @@ def test_create_http_error_with_response(self): """Test that HTTPError with response content triggers proper error handling.""" test_data = { "name": "test-profile", - "folder": "Shared", + "folder": "Texas", "botnet_domains": { "dns_security_categories": [ { @@ -369,7 +369,7 @@ def test_create_generic_exception_handling(self): self.client.create( { "name": "test-profile", - "folder": "Shared", + "folder": "Texas", "botnet_domains": {"dns_security_categories": []}, } ) @@ -402,7 +402,7 @@ def test_get_object_not_present_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Object not found" assert ( @@ -733,7 +733,7 @@ def test_fetch_object_not_present_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="nonexistent", folder="Shared") + self.client.fetch(name="nonexistent", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Object not found" assert ( @@ -743,7 +743,7 @@ def test_fetch_object_not_present_error(self): def test_fetch_empty_name_error(self): """Test fetching with an empty name parameter.""" with pytest.raises(MissingQueryParameterError) as exc_info: - self.client.fetch(name="", folder="Shared") + self.client.fetch(name="", folder="Texas") error_msg = str(exc_info.value) assert '"name" is not allowed to be empty' in error_msg @@ -773,7 +773,7 @@ def test_fetch_multiple_containers_provided_error(self): with pytest.raises(InvalidObjectError) as exc_info: self.client.fetch( name="test-profile", - folder="Shared", + folder="Texas", snippet="TestSnippet", ) @@ -790,7 +790,7 @@ def test_fetch_http_error_no_response_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.fetch(name="test-profile", folder="Shared") + self.client.fetch(name="test-profile", folder="Texas") def test_fetch_server_error(self): """Test handling of server errors during fetch.""" @@ -802,7 +802,7 @@ def test_fetch_server_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "An internal error occurred" assert error_response["_errors"][0]["details"]["errorType"] == "Internal Error" @@ -811,14 +811,14 @@ def test_fetch_missing_id_field_error(self): """Test that InvalidObjectError is raised when the response is missing 'id' field.""" mock_response = { "name": "test-profile", - "folder": "Shared", + "folder": "Texas", "botnet_domains": {}, } self.mock_scm.get.return_value = mock_response # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test-profile", folder="Shared") + self.client.fetch(name="test-profile", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg @@ -830,7 +830,7 @@ def test_fetch_invalid_response_type_error(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test123", folder="Shared") + self.client.fetch(name="test123", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg diff --git a/tests/scm/config/security/test_security_rules.py b/tests/scm/config/security/test_security_rules.py index 9a17706e..f83935d2 100644 --- a/tests/scm/config/security/test_security_rules.py +++ b/tests/scm/config/security/test_security_rules.py @@ -61,12 +61,12 @@ def test_list_valid(self): "data": [ SecurityRuleResponseFactory( name="rule1", - folder="Shared", + folder="Texas", action=SecurityRuleAction.allow, ).model_dump(by_alias=True), SecurityRuleResponseFactory( name="rule2", - folder="Shared", + folder="Texas", action=SecurityRuleAction.deny, ).model_dump(by_alias=True), ], @@ -76,13 +76,13 @@ def test_list_valid(self): } self.mock_scm.get.return_value = mock_response # noqa - existing_objects = self.client.list(folder="Shared") + existing_objects = self.client.list(folder="Texas") self.mock_scm.get.assert_called_once_with( # noqa "/config/security/v1/security-rules", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", "position": "pre", }, ) @@ -137,7 +137,7 @@ def test_list_filters_valid(self): "data": [ SecurityRuleResponseFactory( name="rule1", - folder="Shared", + folder="Texas", action=SecurityRuleAction.allow, source=["10.0.0.0/24"], destination=["any"], @@ -150,7 +150,7 @@ def test_list_filters_valid(self): ).model_dump(by_alias=True), SecurityRuleResponseFactory( name="rule2", - folder="Shared", + folder="Texas", action=SecurityRuleAction.deny, source=["any"], destination=["10.1.0.0/24"], @@ -177,7 +177,7 @@ def test_list_filters_valid(self): "profile_setting": ["best-practice"], } - filtered_objects = self.client.list(folder="Shared", **filters) + filtered_objects = self.client.list(folder="Texas", **filters) # Verify the filtering assert len(filtered_objects) == 1 @@ -189,7 +189,7 @@ def test_list_filters_lists_empty(self): mock_response = { "data": [ SecurityRuleResponseFactory( - name="rule1", folder="Shared", action=SecurityRuleAction.allow + name="rule1", folder="Texas", action=SecurityRuleAction.allow ).model_dump(by_alias=True) ] } @@ -197,31 +197,31 @@ def test_list_filters_lists_empty(self): # Empty lists should result in no matches filtered_objects = self.client.list( - folder="Shared", + folder="Texas", action=[], ) assert len(filtered_objects) == 0 filtered_objects = self.client.list( - folder="Shared", + folder="Texas", category=[], ) assert len(filtered_objects) == 0 filtered_objects = self.client.list( - folder="Shared", + folder="Texas", service=[], ) assert len(filtered_objects) == 0 filtered_objects = self.client.list( - folder="Shared", + folder="Texas", disabled=False, ) assert len(filtered_objects) == 1 filtered_objects = self.client.list( - folder="Shared", + folder="Texas", log_setting=[], ) assert len(filtered_objects) == 0 @@ -272,7 +272,7 @@ def test_list_complex_filtering(self): # Test multiple combined filters filtered_objects = self.client.list( - folder="Shared", + folder="Texas", action=[SecurityRuleAction.allow], source=["10.0.0.0/24"], tag=["tag1"], @@ -344,25 +344,25 @@ def test_list_filters_disabled_functionality(self): SecurityRuleResponseFactory( name="rule1", disabled=True, - folder="Shared", + folder="Texas", ).model_dump(by_alias=True), SecurityRuleResponseFactory( name="rule2", disabled=False, - folder="Shared", + folder="Texas", ).model_dump(by_alias=True), ] } self.mock_scm.get.return_value = mock_response # noqa # Test filtering disabled rules - filtered_objects = self.client.list(folder="Shared", disabled=True) + filtered_objects = self.client.list(folder="Texas", disabled=True) assert len(filtered_objects) == 1 assert filtered_objects[0].name == "rule1" assert filtered_objects[0].disabled is True # Test filtering enabled rules - filtered_objects = self.client.list(folder="Shared", disabled=False) + filtered_objects = self.client.list(folder="Texas", disabled=False) assert len(filtered_objects) == 1 assert filtered_objects[0].name == "rule2" assert filtered_objects[0].disabled is False @@ -374,12 +374,12 @@ def test_list_filters_log_setting_functionality(self): SecurityRuleResponseFactory( name="rule1", log_setting="default-logging", - folder="Shared", + folder="Texas", ).model_dump(by_alias=True), SecurityRuleResponseFactory( name="rule2", log_setting="custom-logging", - folder="Shared", + folder="Texas", ).model_dump(by_alias=True), ] } @@ -387,7 +387,7 @@ def test_list_filters_log_setting_functionality(self): # Test filtering by log setting filtered_objects = self.client.list( - folder="Shared", log_setting=["default-logging"] + folder="Texas", log_setting=["default-logging"] ) assert len(filtered_objects) == 1 assert filtered_objects[0].name == "rule1" @@ -395,7 +395,7 @@ def test_list_filters_log_setting_functionality(self): # Test filtering by multiple log settings filtered_objects = self.client.list( - folder="Shared", log_setting=["default-logging", "custom-logging"] + folder="Texas", log_setting=["default-logging", "custom-logging"] ) assert len(filtered_objects) == 2 @@ -404,7 +404,7 @@ def test_list_response_invalid_format(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert exc_info.value.error_code == "E003" assert exc_info.value.http_status_code == 500 @@ -415,7 +415,7 @@ def test_list_response_invalid_data_field_missing(self): self.mock_scm.get.return_value = {"wrong_field": "value"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -428,7 +428,7 @@ def test_list_response_invalid_data_field_type(self): self.mock_scm.get.return_value = {"data": "not a list"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -445,11 +445,11 @@ def test_list_http_error_no_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.list(folder="Shared") + self.client.list(folder="Texas") def test_list_invalid_action_filter(self): """Test that list method raises InvalidObjectError when 'action' filter is not a list.""" - folder = "Shared" + folder = "Texas" filters = {"action": "allow"} # Should be a list, not a string with pytest.raises(InvalidObjectError) as exc_info: @@ -458,7 +458,7 @@ def test_list_invalid_action_filter(self): def test_list_invalid_disabled_filter(self): """Test that list method raises InvalidObjectError when 'disabled' filter is not a bool.""" - folder = "Shared" + folder = "Texas" filters = {"disabled": "True"} # Should be a bool, not a string with pytest.raises(InvalidObjectError) as exc_info: @@ -467,7 +467,7 @@ def test_list_invalid_disabled_filter(self): def test_list_invalid_source_filter(self): """Test that list method raises InvalidObjectError when 'source' filter is not a list.""" - folder = "Shared" + folder = "Texas" filters = {"source": "192.168.1.1"} # Should be a list, not a string with pytest.raises(InvalidObjectError) as exc_info: @@ -476,7 +476,7 @@ def test_list_invalid_source_filter(self): def test_list_invalid_profile_setting_filter(self): """Test that list method raises InvalidObjectError when 'profile_setting' filter is not a list.""" - folder = "Shared" + folder = "Texas" filters = {"profile_setting": "default"} # Should be a list, not a string with pytest.raises(InvalidObjectError) as exc_info: @@ -485,7 +485,7 @@ def test_list_invalid_profile_setting_filter(self): def test_list_invalid_rulebase(self): """Test that list method raises InvalidObjectError when rulebase is invalid.""" - folder = "Shared" + folder = "Texas" invalid_rulebase = "invalid" with pytest.raises(InvalidObjectError): @@ -525,7 +525,7 @@ def test_create_http_error_no_content(self): self.client.create( { "name": "test", - "folder": "Shared", + "folder": "Texas", "action": "allow", } ) @@ -553,7 +553,7 @@ def test_create_http_error_with_response(self): """Test that HTTPError with response content triggers proper error handling.""" test_data = { "name": "test-rule", - "folder": "Shared", + "folder": "Texas", "action": "allow", "from": ["any"], "to": ["any"], @@ -582,7 +582,7 @@ def test_create_generic_exception_handling(self): self.client.create( { "name": "test-rule", - "folder": "Shared", + "folder": "Texas", "action": "allow", } ) @@ -592,7 +592,7 @@ def test_create_invalid_rulebase(self): """Test that create method raises InvalidObjectError when rulebase is invalid.""" data = { "name": "test-rule", - "folder": "Shared", + "folder": "Texas", "source": ["any"], "destination": ["any"], "action": "allow", @@ -630,7 +630,7 @@ def test_get_object_not_present_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Object not found" assert ( @@ -1020,7 +1020,7 @@ def test_fetch_object_not_present_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="nonexistent", folder="Shared") + self.client.fetch(name="nonexistent", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Object not found" assert ( @@ -1030,7 +1030,7 @@ def test_fetch_object_not_present_error(self): def test_fetch_empty_name_error(self): """Test fetching with an empty name parameter.""" with pytest.raises(MissingQueryParameterError) as exc_info: - self.client.fetch(name="", folder="Shared") + self.client.fetch(name="", folder="Texas") error_msg = str(exc_info.value) assert '"name" is not allowed to be empty' in error_msg @@ -1060,7 +1060,7 @@ def test_fetch_multiple_containers_provided_error(self): with pytest.raises(InvalidObjectError) as exc_info: self.client.fetch( name="test-rule", - folder="Shared", + folder="Texas", snippet="TestSnippet", ) @@ -1077,7 +1077,7 @@ def test_fetch_http_error_no_response_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.fetch(name="test-rule", folder="Shared") + self.client.fetch(name="test-rule", folder="Texas") def test_fetch_server_error(self): """Test handling of server errors during fetch.""" @@ -1089,7 +1089,7 @@ def test_fetch_server_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "An internal error occurred" assert error_response["_errors"][0]["details"]["errorType"] == "Internal Error" @@ -1098,14 +1098,14 @@ def test_fetch_missing_id_field_error(self): """Test that InvalidObjectError is raised when the response is missing 'id' field.""" mock_response = { "name": "test-rule", - "folder": "Shared", + "folder": "Texas", "action": "allow", } self.mock_scm.get.return_value = mock_response # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test-rule", folder="Shared") + self.client.fetch(name="test-rule", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg @@ -1117,7 +1117,7 @@ def test_fetch_invalid_response_type_error(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test123", folder="Shared") + self.client.fetch(name="test123", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg @@ -1127,7 +1127,7 @@ def test_fetch_invalid_response_type_error(self): def test_fetch_invalid_rulebase(self): """Test that fetch method raises InvalidObjectError when rulebase is invalid.""" name = "test-rule" - folder = "Shared" + folder = "Texas" invalid_rulebase = "invalid" with pytest.raises(InvalidObjectError): @@ -1307,7 +1307,7 @@ def test_security_rule_profile_setting_group_unique(self): def test_ensure_list_of_strings_single_string(self): """Test that a single string is converted to a list containing that string.""" model = SecurityRuleCreateModel( - name="test-rule", source="192.168.1.1", folder="Shared" # noqa + name="test-rule", source="192.168.1.1", folder="Texas" # noqa ) assert model.source == ["192.168.1.1"] @@ -1317,21 +1317,21 @@ def test_ensure_list_of_strings_invalid_type(self): SecurityRuleCreateModel( name="test-rule", source=123, # noqa - folder="Shared", + folder="Texas", ) # noqa def test_ensure_list_of_strings_non_string_items(self): """Test that a list containing non-string items raises a ValueError.""" with pytest.raises(ValueError, match="All items must be strings"): SecurityRuleCreateModel( - name="test-rule", source=["192.168.1.1", 123], folder="Shared" + name="test-rule", source=["192.168.1.1", 123], folder="Texas" ) def test_ensure_unique_items_duplicates(self): """Test that duplicate items in lists raise a ValueError.""" with pytest.raises(ValueError, match="List items must be unique"): SecurityRuleCreateModel( - name="test-rule", source=["192.168.1.1", "192.168.1.1"], folder="Shared" + name="test-rule", source=["192.168.1.1", "192.168.1.1"], folder="Texas" ) def test_security_rule_create_no_container(self): @@ -1349,7 +1349,7 @@ def test_security_rule_create_multiple_containers(self): match="Exactly one of 'folder', 'snippet', or 'device' must be provided.", ): SecurityRuleCreateModel( - name="test-rule", folder="Shared", snippet="MySnippet" + name="test-rule", folder="Texas", snippet="MySnippet" ) def test_move_model_unexpected_destination_rule_top(self): diff --git a/tests/scm/config/security/test_vulnerability_protection_profiles.py b/tests/scm/config/security/test_vulnerability_protection_profiles.py index a6068543..f94d9a02 100644 --- a/tests/scm/config/security/test_vulnerability_protection_profiles.py +++ b/tests/scm/config/security/test_vulnerability_protection_profiles.py @@ -57,12 +57,12 @@ def test_list_valid(self): "data": [ VulnerabilityProfileResponseFactory( name="profile1", - folder="Shared", + folder="Texas", rules=[VulnerabilityProfileRuleModelFactory()], ).model_dump(), VulnerabilityProfileResponseFactory( name="profile2", - folder="Shared", + folder="Texas", rules=[VulnerabilityProfileRuleModelFactory()], ).model_dump(), ], @@ -72,13 +72,13 @@ def test_list_valid(self): } self.mock_scm.get.return_value = mock_response # noqa - existing_objects = self.client.list(folder="Shared") + existing_objects = self.client.list(folder="Texas") self.mock_scm.get.assert_called_once_with( # noqa "/config/security/v1/vulnerability-protection-profiles", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) assert isinstance(existing_objects, list) @@ -134,13 +134,13 @@ def test_list_filters_valid(self): mock_response = {"data": []} self.mock_scm.get.return_value = mock_response # noqa - self.client.list(folder="Shared", **filters) + self.client.list(folder="Texas", **filters) self.mock_scm.get.assert_called_once_with( # noqa "/config/security/v1/vulnerability-protection-profiles", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) @@ -150,7 +150,7 @@ def test_list_filters_lists_empty(self): "data": [ VulnerabilityProfileResponseFactory( name="profile1", - folder="Shared", + folder="Texas", rules=[VulnerabilityProfileRuleModelFactory()], ).model_dump() ] @@ -158,7 +158,7 @@ def test_list_filters_lists_empty(self): self.mock_scm.get.return_value = mock_response # noqa filtered_objects = self.client.list( - folder="Shared", + folder="Texas", severity=[], ) assert len(filtered_objects) == 0 @@ -170,7 +170,7 @@ def test_list_filters_types(self): "data": [ VulnerabilityProfileResponseFactory( name="profile1", - folder="Shared", + folder="Texas", rules=[VulnerabilityProfileRuleModelFactory()], ).model_dump() ] @@ -184,7 +184,7 @@ def test_list_filters_types(self): error_type="Invalid Query Parameter", ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared", severity="critical") + self.client.list(folder="Texas", severity="critical") error_response = exc_info.value.response.json() assert ( error_response["_errors"][0]["message"] @@ -202,7 +202,7 @@ def test_list_filters_types(self): # Test that valid list filters pass validation try: self.client.list( - folder="Shared", + folder="Texas", severity=["critical"], ) except HTTPError: @@ -225,7 +225,7 @@ def test_list_response_invalid_format(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert exc_info.value.error_code == "E003" assert exc_info.value.http_status_code == 500 @@ -236,7 +236,7 @@ def test_list_response_invalid_data_field_missing(self): self.mock_scm.get.return_value = {"wrong_field": "value"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -249,7 +249,7 @@ def test_list_response_invalid_data_field_type(self): self.mock_scm.get.return_value = {"data": "not a list"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error = exc_info.value assert isinstance(error, InvalidObjectError) @@ -266,7 +266,7 @@ def test_list_http_error_no_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.list(folder="Shared") + self.client.list(folder="Texas") def test_list_filters_invalid_rules(self): """Test that _apply_filters raises InvalidObjectError for invalid rules filter.""" @@ -301,7 +301,7 @@ def test_filter_by_threat_exceptions(self): self.mock_scm.get.return_value = mock_response # noqa filtered_objects = self.client.list( - folder="Shared", + folder="Texas", rules__name=["threat1"], # Filter on the rules' name field ) assert len(filtered_objects) == 2 @@ -336,7 +336,7 @@ def test_create_http_error_no_content(self): self.mock_scm.post.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.create({"name": "test", "folder": "Shared", "rules": []}) + self.client.create({"name": "test", "folder": "Texas", "rules": []}) def test_create_with_rules(self): """Test creating profile with specific rules configuration.""" @@ -420,7 +420,7 @@ def test_create_http_error_with_response(self): """Test that HTTPError with response content triggers proper error handling.""" test_data = { "name": "test-profile", - "folder": "Shared", + "folder": "Texas", "rules": [ { "name": "TestRule", @@ -454,7 +454,7 @@ def test_create_generic_exception_handling(self): self.client.create( { "name": "test-profile", - "folder": "Shared", + "folder": "Texas", "rules": [], } ) @@ -532,7 +532,7 @@ def test_get_object_not_present_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Object not found" assert ( @@ -898,7 +898,7 @@ def test_fetch_object_not_present_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="nonexistent", folder="Shared") + self.client.fetch(name="nonexistent", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Object not found" assert ( @@ -908,7 +908,7 @@ def test_fetch_object_not_present_error(self): def test_fetch_empty_name_error(self): """Test fetching with an empty name parameter.""" with pytest.raises(MissingQueryParameterError) as exc_info: - self.client.fetch(name="", folder="Shared") + self.client.fetch(name="", folder="Texas") error_msg = str(exc_info.value) assert '"name" is not allowed to be empty' in error_msg @@ -938,7 +938,7 @@ def test_fetch_multiple_containers_provided_error(self): with pytest.raises(InvalidObjectError) as exc_info: self.client.fetch( name="test-profile", - folder="Shared", + folder="Texas", snippet="TestSnippet", ) @@ -955,7 +955,7 @@ def test_fetch_http_error_no_response_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.fetch(name="test-profile", folder="Shared") + self.client.fetch(name="test-profile", folder="Texas") def test_fetch_server_error(self): """Test handling of server errors during fetch.""" @@ -967,7 +967,7 @@ def test_fetch_server_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "An internal error occurred" assert error_response["_errors"][0]["details"]["errorType"] == "Internal Error" @@ -976,14 +976,14 @@ def test_fetch_missing_id_field_error(self): """Test that InvalidObjectError is raised when the response is missing 'id' field.""" mock_response = { "name": "test-profile", - "folder": "Shared", + "folder": "Texas", "rules": [], } self.mock_scm.get.return_value = mock_response # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test-profile", folder="Shared") + self.client.fetch(name="test-profile", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg @@ -995,7 +995,7 @@ def test_fetch_invalid_response_type_error(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test123", folder="Shared") + self.client.fetch(name="test123", folder="Texas") error_msg = str(exc_info.value) assert "HTTP error: 500 - API error: E003" in error_msg diff --git a/tests/scm/config/security/test_wildfire_antivirus_profiles.py b/tests/scm/config/security/test_wildfire_antivirus_profiles.py index 568adc65..73d37dad 100644 --- a/tests/scm/config/security/test_wildfire_antivirus_profiles.py +++ b/tests/scm/config/security/test_wildfire_antivirus_profiles.py @@ -74,7 +74,7 @@ def test_object_model_multiple_containers(self): """Test validation when multiple containers are provided.""" data = { "name": "InvalidProfile", - "folder": "Shared", + "folder": "Texas", "device": "Device1", "rules": [ { @@ -664,7 +664,7 @@ def test_fetch_object_not_found(self): 3. Asserts that ObjectNotPresentError is raised """ object_name = "NonExistent" - folder_name = "Shared" + folder_name = "Texas" self.mock_scm.get.side_effect = raise_mock_http_error( # noqa status_code=404, @@ -698,7 +698,7 @@ def test_fetch_empty_name(self): 2. Verifies MissingQueryParameterError is raised """ with pytest.raises(MissingQueryParameterError) as exc_info: - self.client.fetch(name="", folder="Shared") + self.client.fetch(name="", folder="Texas") assert ( "{'field': 'name', 'error': '\"name\" is not allowed to be empty'} - HTTP error: 400 - API error: E003" in str(exc_info.value) @@ -727,14 +727,14 @@ def test_fetch_container_validation(self): # Test multiple containers provided with pytest.raises(InvalidObjectError) as exc_info: self.client.fetch( - name="test-profile", folder="Shared", snippet="TestSnippet" + name="test-profile", folder="Texas", snippet="TestSnippet" ) assert "HTTP error: 400 - API error: E003" in str(exc_info.value) def test_fetch_object_unexpected_response_format(self): """Test fetching an object when the API returns an unexpected format.""" group_name = "TestGroup" - folder_name = "Shared" + folder_name = "Texas" self.mock_scm.get.side_effect = raise_mock_http_error( # noqa status_code=400, @@ -759,7 +759,7 @@ def test_fetch_error_handler_json_error(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.fetch(name="test", folder="Shared") + self.client.fetch(name="test", folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Input Format Mismatch" assert ( @@ -772,7 +772,7 @@ def test_fetch_response_not_dict(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test-profile", folder="Shared") + self.client.fetch(name="test-profile", folder="Texas") assert exc_info.value.error_code == "E003" assert exc_info.value.http_status_code == 500 @@ -782,12 +782,12 @@ def test_fetch_response_missing_id_field(self): """Test that InvalidObjectError is raised when response is missing 'id' field.""" self.mock_scm.get.return_value = { # noqa "name": "test-profile", - "folder": "Shared", + "folder": "Texas", "rules": [], } # Missing 'id' field with pytest.raises(InvalidObjectError) as exc_info: - self.client.fetch(name="test-profile", folder="Shared") + self.client.fetch(name="test-profile", folder="Texas") assert exc_info.value.error_code == "E003" assert exc_info.value.http_status_code == 500 @@ -804,7 +804,7 @@ def test_fetch_http_error_no_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.fetch(name="test-profile", folder="Shared") + self.client.fetch(name="test-profile", folder="Texas") class TestWildfireAntivirusProfileListFilters(TestWildfireAntivirusProfileBase): @@ -825,13 +825,13 @@ def test_list_with_filters(self): mock_response = {"data": []} self.mock_scm.get.return_value = mock_response # noqa - self.client.list(folder="Shared", **filters) + self.client.list(folder="Texas", **filters) self.mock_scm.get.assert_called_once_with( # noqa "/config/security/v1/wildfire-anti-virus-profiles", params={ "limit": 10000, - "folder": "Shared", + "folder": "Texas", }, ) @@ -871,7 +871,7 @@ def test_list_non_dict_response(self): ) with pytest.raises(HTTPError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") error_response = exc_info.value.response.json() assert error_response["_errors"][0]["message"] == "Invalid Object" assert error_response["_errors"][0]["details"]["errorType"] == "Invalid Object" @@ -880,7 +880,7 @@ def test_list_non_dict_response(self): self.mock_scm.get.assert_called_once_with( # noqa "/config/security/v1/wildfire-anti-virus-profiles", params={ - "folder": "Shared", + "folder": "Texas", "limit": 10000, }, ) @@ -914,16 +914,16 @@ def test_list_filters_type_validation(self): # Test invalid rules filter (string instead of list) with pytest.raises(InvalidObjectError): - self.client.list(folder="Shared", rules="rule1") + self.client.list(folder="Texas", rules="rule1") # Test invalid rules filter (dict instead of list) with pytest.raises(InvalidObjectError): - self.client.list(folder="Shared", rules={"rule": "rule1"}) + self.client.list(folder="Texas", rules={"rule": "rule1"}) # Test that valid list filters pass validation try: self.client.list( - folder="Shared", + folder="Texas", rules=["rule1"], ) except InvalidObjectError: @@ -934,7 +934,7 @@ def test_list_response_not_dict(self): self.mock_scm.get.return_value = ["not", "a", "dictionary"] # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert exc_info.value.error_code == "E003" assert exc_info.value.http_status_code == 500 @@ -945,7 +945,7 @@ def test_list_response_missing_data_field(self): self.mock_scm.get.return_value = {"invalid": "data"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert exc_info.value.error_code == "E003" assert exc_info.value.http_status_code == 500 @@ -956,7 +956,7 @@ def test_list_response_data_not_list(self): self.mock_scm.get.return_value = {"data": "not a list"} # noqa with pytest.raises(InvalidObjectError) as exc_info: - self.client.list(folder="Shared") + self.client.list(folder="Texas") assert exc_info.value.error_code == "E003" assert exc_info.value.http_status_code == 500 @@ -973,7 +973,7 @@ def test_list_http_error_no_content(self): self.mock_scm.get.side_effect = mock_http_error # noqa with pytest.raises(HTTPError): - self.client.list(folder="Shared") + self.client.list(folder="Texas") # -------------------- End of Test Classes -------------------- diff --git a/tests/scm/models/objects/test_address_group_models.py b/tests/scm/models/objects/test_address_group_models.py index f5391d5a..b71fb8a7 100644 --- a/tests/scm/models/objects/test_address_group_models.py +++ b/tests/scm/models/objects/test_address_group_models.py @@ -65,7 +65,7 @@ def test_address_group_create_model_multiple_containers_provided(self): def test_address_group_create_model_missing_required_fields_error(self): """Test validation when required fields are missing.""" - data = {"static": ["address1", "address2"], "folder": "Shared"} + data = {"static": ["address1", "address2"], "folder": "Texas"} with pytest.raises(ValidationError) as exc_info: AddressGroupCreateModel(**data) error_msg = str(exc_info.value) @@ -200,7 +200,7 @@ def test_address_group_update_model_missing_group_type(self): data = { "id": "123e4567-e89b-12d3-a456-426655440000", "name": "test-address-group", - "folder": "Shared", + "folder": "Texas", } with pytest.raises(ValidationError) as exc_info: AddressGroupUpdateModel(**data) diff --git a/tests/scm/models/objects/test_address_models.py b/tests/scm/models/objects/test_address_models.py index 61e2ec4f..7630c431 100644 --- a/tests/scm/models/objects/test_address_models.py +++ b/tests/scm/models/objects/test_address_models.py @@ -75,7 +75,7 @@ def test_address_create_model_missing_required_fields_error(self): def test_address_create_model_missing_address_type(self): """Test validation when required address type is missing.""" - data = {"name": "test", "folder": "Shared"} + data = {"name": "test", "folder": "Texas"} with pytest.raises(ValidationError) as exc_info: AddressCreateModel(**data) assert "1 validation error for AddressCreateModel" in str(exc_info.value) @@ -149,7 +149,7 @@ def test_address_update_model_missing_address_type(self): data = { "id": "123e4567-e89b-12d3-a456-426655440000", "name": "test-address", - "folder": "Shared", + "folder": "Texas", } with pytest.raises(ValidationError) as exc_info: AddressUpdateModel(**data) diff --git a/tests/scm/models/objects/test_application_group_models.py b/tests/scm/models/objects/test_application_group_models.py index c6e4b231..1ed5061e 100644 --- a/tests/scm/models/objects/test_application_group_models.py +++ b/tests/scm/models/objects/test_application_group_models.py @@ -22,7 +22,7 @@ def test_application_group_create_model_valid(self): """Test validation with valid data.""" data = { "name": "Microsoft 365 Access", - "folder": "Shared", + "folder": "Texas", "members": ["office365-consumer-access", "office365-enterprise-access"], } model = ApplicationGroupCreateModel(**data) @@ -34,7 +34,7 @@ def test_application_group_create_model_multiple_containers(self): """Test validation when multiple containers are provided.""" data = { "name": "Microsoft 365 Access", - "folder": "Shared", + "folder": "Texas", "snippet": "office365", "device": "firewall1", "members": ["office365-consumer-access", "office365-enterprise-access"], @@ -62,7 +62,7 @@ def test_application_group_create_model_no_container(self): def test_application_group_create_model_missing_required_fields(self): """Test validation when required fields are missing.""" data = { - "folder": "Shared", + "folder": "Texas", } with pytest.raises(ValidationError) as exc_info: ApplicationGroupCreateModel(**data) @@ -75,7 +75,7 @@ def test_application_group_create_model_invalid_name(self): """Test validation of name field constraints.""" data = { "name": "invalid@name#", - "folder": "Shared", + "folder": "Texas", "members": ["app1", "app2"], } with pytest.raises(ValidationError) as exc_info: @@ -86,7 +86,7 @@ def test_application_group_create_model_empty_members(self): """Test validation when members list is empty.""" data = { "name": "test-group", - "folder": "Shared", + "folder": "Texas", "members": [], } with pytest.raises(ValidationError) as exc_info: @@ -105,7 +105,7 @@ def test_application_group_update_model_valid(self): "id": "123e4567-e89b-12d3-a456-426655440000", "name": "Microsoft 365 Access", "members": ["office365-consumer-access", "office365-enterprise-access"], - "folder": "Shared", + "folder": "Texas", } model = ApplicationGroupUpdateModel(**data) assert model.name == data["name"] @@ -156,7 +156,7 @@ def test_application_group_response_model_valid(self): "id": "123e4567-e89b-12d3-a456-426655440000", "name": "Microsoft 365 Access", "members": ["office365-consumer-access", "office365-enterprise-access"], - "folder": "Shared", + "folder": "Texas", } model = ApplicationGroupResponseModel(**data) assert str(model.id) == data["id"] @@ -169,7 +169,7 @@ def test_application_group_response_model_missing_id(self): data = { "name": "Microsoft 365 Access", "members": ["office365-consumer-access"], - "folder": "Shared", + "folder": "Texas", } with pytest.raises(ValidationError) as exc_info: ApplicationGroupResponseModel(**data) @@ -181,7 +181,7 @@ def test_application_group_response_model_invalid_id(self): "id": "invalid-uuid", "name": "Microsoft 365 Access", "members": ["office365-consumer-access"], - "folder": "Shared", + "folder": "Texas", } with pytest.raises(ValidationError) as exc_info: ApplicationGroupResponseModel(**data) diff --git a/tests/scm/models/objects/test_service_group_models.py b/tests/scm/models/objects/test_service_group_models.py index a840c694..2f2167e9 100644 --- a/tests/scm/models/objects/test_service_group_models.py +++ b/tests/scm/models/objects/test_service_group_models.py @@ -23,7 +23,7 @@ def test_service_group_create_model_valid(self): """Test validation with valid data.""" data = { "name": "Microsoft 365 Access", - "folder": "Shared", + "folder": "Texas", "members": ["office365-consumer-access", "office365-enterprise-access"], } model = ServiceGroupCreateModel(**data) @@ -35,7 +35,7 @@ def test_service_group_create_model_multiple_containers(self): """Test validation when multiple containers are provided.""" data = { "name": "Microsoft 365 Access", - "folder": "Shared", + "folder": "Texas", "snippet": "office365", "device": "firewall1", "members": ["office365-consumer-access", "office365-enterprise-access"], @@ -63,7 +63,7 @@ def test_service_group_create_model_no_container(self): def test_service_group_create_model_missing_required_fields(self): """Test validation when required fields are missing.""" data = { - "folder": "Shared", + "folder": "Texas", } with pytest.raises(ValidationError) as exc_info: ServiceGroupCreateModel(**data) @@ -76,7 +76,7 @@ def test_service_group_create_model_invalid_name(self): """Test validation of name field constraints.""" data = { "name": "invalid@name#", - "folder": "Shared", + "folder": "Texas", "members": ["app1", "app2"], } with pytest.raises(ValidationError) as exc_info: @@ -87,7 +87,7 @@ def test_service_group_create_model_empty_members(self): """Test validation when members list is empty.""" data = { "name": "test-group", - "folder": "Shared", + "folder": "Texas", "members": [], } with pytest.raises(ValidationError) as exc_info: @@ -112,7 +112,7 @@ def test_ensure_list_of_strings_invalid_type(self): ServiceGroupCreateModel( name="test-rule", members=123, # noqa - folder="Shared", + folder="Texas", ) def test_ensure_list_of_strings_non_string_items(self): @@ -121,7 +121,7 @@ def test_ensure_list_of_strings_non_string_items(self): ServiceGroupCreateModel( name="test-rule", members=["test1", 123], - folder="Shared", + folder="Texas", ) def test_ensure_unique_items_duplicates(self): @@ -130,7 +130,7 @@ def test_ensure_unique_items_duplicates(self): ServiceGroupCreateModel( name="test-rule", members=["test1", "test1"], - folder="Shared", + folder="Texas", ) @@ -143,7 +143,7 @@ def test_service_group_update_model_valid(self): "id": "123e4567-e89b-12d3-a456-426655440000", "name": "Microsoft 365 Access", "members": ["office365-consumer-access", "office365-enterprise-access"], - "folder": "Shared", + "folder": "Texas", } model = ServiceGroupUpdateModel(**data) assert model.name == data["name"] @@ -194,7 +194,7 @@ def test_service_group_response_model_valid(self): "id": "123e4567-e89b-12d3-a456-426655440000", "name": "Microsoft 365 Access", "members": ["office365-consumer-access", "office365-enterprise-access"], - "folder": "Shared", + "folder": "Texas", } model = ServiceGroupResponseModel(**data) assert str(model.id) == data["id"] @@ -207,7 +207,7 @@ def test_service_group_response_model_missing_id(self): data = { "name": "Microsoft 365 Access", "members": ["office365-consumer-access"], - "folder": "Shared", + "folder": "Texas", } with pytest.raises(ValidationError) as exc_info: ServiceGroupResponseModel(**data) @@ -219,7 +219,7 @@ def test_service_group_response_model_invalid_id(self): "id": "invalid-uuid", "name": "Microsoft 365 Access", "members": ["office365-consumer-access"], - "folder": "Shared", + "folder": "Texas", } with pytest.raises(ValidationError) as exc_info: ServiceGroupResponseModel(**data) diff --git a/tests/scm/models/objects/test_service_models.py b/tests/scm/models/objects/test_service_models.py index f26c530d..b4ffaf34 100644 --- a/tests/scm/models/objects/test_service_models.py +++ b/tests/scm/models/objects/test_service_models.py @@ -193,7 +193,7 @@ def test_service_create_model_invalid_name(self): """Test validation of name field constraints.""" data = { "name": "invalid@name#", - "folder": "Shared", + "folder": "Texas", "protocol": {"tcp": {"port": "80"}}, } with pytest.raises(ValidationError) as exc_info: @@ -257,13 +257,13 @@ def test_service_response_model_valid(self): "id": "123e4567-e89b-12d3-a456-426655440000", "name": "test-service", "protocol": {"tcp": {"port": "80"}}, - "folder": "Shared", + "folder": "Texas", } model = ServiceResponseModel(**data) assert str(model.id) == data["id"] assert model.name == data["name"] assert model.protocol.tcp.port == "80" - assert model.folder == "Shared" + assert model.folder == "Texas" def test_service_response_model_optional_fields(self): """Test validation with optional fields in response.""" diff --git a/tests/scm/models/objects/test_tag_models.py b/tests/scm/models/objects/test_tag_models.py index caa625f8..b290c19b 100644 --- a/tests/scm/models/objects/test_tag_models.py +++ b/tests/scm/models/objects/test_tag_models.py @@ -23,7 +23,7 @@ def test_tag_create_model_valid(self): """Test validation with valid data.""" data = { "name": "test-tag", - "folder": "Shared", + "folder": "Texas", "comments": "Test tag", "color": "Red", } @@ -44,7 +44,7 @@ def test_tag_create_model_invalid_name(self): """Test validation with invalid name pattern.""" data = { "name": "@invalid_name$", - "folder": "Shared", + "folder": "Texas", } with pytest.raises(ValidationError) as exc_info: TagCreateModel(**data) @@ -54,7 +54,7 @@ def test_tag_create_model_name_too_long(self): """Test validation when name exceeds maximum length.""" data = { "name": "a" * 64, # Max length is 63 - "folder": "Shared", + "folder": "Texas", } with pytest.raises(ValidationError) as exc_info: TagCreateModel(**data) @@ -87,7 +87,7 @@ def test_tag_create_model_comments_too_long(self): """Test validation when comments exceed maximum length.""" data = { "name": "test-tag", - "folder": "Shared", + "folder": "Texas", "comments": "a" * 1024, # Max length is 1023 } with pytest.raises(ValidationError) as exc_info: @@ -98,7 +98,7 @@ def test_tag_create_model_none_color(self): """Test validation when color is None.""" data = { "name": "test-tag", - "folder": "Shared", + "folder": "Texas", "color": None, } model = TagCreateModel(**data) @@ -158,7 +158,7 @@ def test_tag_response_model_valid(self): data = { "id": "123e4567-e89b-12d3-a456-426655440000", "name": "test-tag", - "folder": "Shared", + "folder": "Texas", "comments": "Test tag", "color": "Red", } diff --git a/tests/scm/models/security/test_anti_spyware_profile_models.py b/tests/scm/models/security/test_anti_spyware_profile_models.py index fc500b10..369f0bff 100644 --- a/tests/scm/models/security/test_anti_spyware_profile_models.py +++ b/tests/scm/models/security/test_anti_spyware_profile_models.py @@ -162,7 +162,7 @@ def test_profile_response_model_valid(self): data = { "id": "123e4567-e89b-12d3-a456-426655440000", "name": "TestProfile", - "folder": "Shared", + "folder": "Texas", "rules": [ { "name": "TestRule", @@ -182,7 +182,7 @@ def test_profile_response_model_invalid_uuid(self): data = { "id": "invalid-uuid", "name": "TestProfile", - "folder": "Shared", + "folder": "Texas", "rules": [], } with pytest.raises(ValidationError) as exc_info: diff --git a/tests/scm/models/security/test_dns_security_profiles_models.py b/tests/scm/models/security/test_dns_security_profiles_models.py index bc1e7e29..c5441bab 100644 --- a/tests/scm/models/security/test_dns_security_profiles_models.py +++ b/tests/scm/models/security/test_dns_security_profiles_models.py @@ -227,7 +227,7 @@ def test_dns_security_profile_response_model_valid(self): model = DNSSecurityProfileResponseModel(**data) assert isinstance(model.id, UUID) assert model.name.startswith("dns_security_profile_") - assert model.folder == "Shared" + assert model.folder == "Texas" assert model.botnet_domains is not None def test_dns_security_profile_response_model_from_request(self): diff --git a/tests/scm/models/security/test_security_rules_models.py b/tests/scm/models/security/test_security_rules_models.py index aa863f26..f7bd6ab7 100644 --- a/tests/scm/models/security/test_security_rules_models.py +++ b/tests/scm/models/security/test_security_rules_models.py @@ -228,7 +228,7 @@ def test_security_rule_response_model_valid(self): model = SecurityRuleResponseModel(**data) assert isinstance(model.id, UUID) assert model.name.startswith("security_rule_") - assert model.folder == "Shared" + assert model.folder == "Texas" assert model.action == SecurityRuleAction.allow def test_security_rule_response_model_from_request(self): diff --git a/tests/scm/models/security/test_vulnerability_protection_profile_models.py b/tests/scm/models/security/test_vulnerability_protection_profile_models.py index 3c50bcc1..1edf54fc 100644 --- a/tests/scm/models/security/test_vulnerability_protection_profile_models.py +++ b/tests/scm/models/security/test_vulnerability_protection_profile_models.py @@ -283,7 +283,7 @@ def test_vulnerability_profile_response_model_valid(self): model = VulnerabilityProfileResponseModel(**data) assert isinstance(model.id, UUID) assert model.name.startswith("valid-profile-name") - assert model.folder == "Shared" + assert model.folder == "Texas" assert len(model.rules) > 0 diff --git a/tests/scm/models/security/test_wildfire_antivirus_profiles.py b/tests/scm/models/security/test_wildfire_antivirus_profiles.py index 7cb6758a..3815489f 100644 --- a/tests/scm/models/security/test_wildfire_antivirus_profiles.py +++ b/tests/scm/models/security/test_wildfire_antivirus_profiles.py @@ -35,7 +35,7 @@ def test_wildfire_av_profile_create_model_valid(self): data = WildfireAvProfileCreateModelFactory.build_valid() model = WildfireAvProfileCreateModel(**data) assert model.name == "TestWildfireProfile" - assert model.folder == "Shared" + assert model.folder == "Texas" assert len(model.rules) == 1 assert model.rules[0].direction == WildfireAvDirection.both assert model.rules[0].analysis == WildfireAvAnalysis.public_cloud @@ -140,7 +140,7 @@ def test_wildfire_av_profile_response_model_valid(self): model = WildfireAvProfileResponseModel(**data) assert isinstance(model.id, UUID) assert model.name.startswith("wildfire_profile_") - assert model.folder == "Shared" + assert model.folder == "Texas" assert len(model.rules) > 0 def test_wildfire_av_profile_response_model_from_request(self):