diff --git a/.gitignore b/.gitignore index 3db0686a..927e29fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ Test Results/ **/test-reports/ __pycache__ -*.egg-info \ No newline at end of file +*.egg-info +.venv/ \ No newline at end of file diff --git a/pnap_bmc_api/pnap_bmc_api/models/quota_edit_limit_request.py b/pnap_bmc_api/pnap_bmc_api/models/quota_edit_limit_request.py index 46987854..338f9ba2 100644 --- a/pnap_bmc_api/pnap_bmc_api/models/quota_edit_limit_request.py +++ b/pnap_bmc_api/pnap_bmc_api/models/quota_edit_limit_request.py @@ -36,8 +36,8 @@ class QuotaEditLimitRequest(BaseModel): @field_validator('reason') def reason_validate_regular_expression(cls, value): """Validates the regular expression""" - if not re.match(r"^(?s)(?!\s*$).+", value): - raise ValueError(r"must validate the regular expression /^(?s)(?!\s*$).+/") + if not re.match(r"(?s)^(?!\s*$).+", value): + raise ValueError("must validate the regular expression /^(?s)(?!\s*$).+/") return value model_config = ConfigDict( diff --git a/pnap_bmc_api/pnap_bmc_api/models/quota_edit_limit_request_details.py b/pnap_bmc_api/pnap_bmc_api/models/quota_edit_limit_request_details.py index 67bcb9c4..6a29524a 100644 --- a/pnap_bmc_api/pnap_bmc_api/models/quota_edit_limit_request_details.py +++ b/pnap_bmc_api/pnap_bmc_api/models/quota_edit_limit_request_details.py @@ -38,8 +38,8 @@ class QuotaEditLimitRequestDetails(BaseModel): @field_validator('reason') def reason_validate_regular_expression(cls, value): """Validates the regular expression""" - if not re.match(r"^(?s)(?!\s*$).+", value): - raise ValueError(r"must validate the regular expression /^(?s)(?!\s*$).+/") + if not re.match(r"(?s)^(?!\s*$).+", value): + raise ValueError("must validate the regular expression /^(?s)(?!\s*$).+/") return value model_config = ConfigDict( diff --git a/tests/README.md b/tests/README.md index 15ef7ee1..e8f8a959 100644 --- a/tests/README.md +++ b/tests/README.md @@ -37,4 +37,16 @@ pip install -r requirements.txt Once this is done, you can then run the respective test script: ```sh python pnap_network_api_test.py -``` \ No newline at end of file +``` + +### Using .venv +If you're using an immutable system, such as *NixOS*, then you'll likely want to use a **virtual environment**. + +This can be easily done by doing the following: +```sh +python3 -m venv .venv +source .venv/bin/activate +``` + +The first command creates the virtual environment, and the second command activates it for the current shell. Once done, you can follow the +instructions above as normal. \ No newline at end of file diff --git a/tests/payloads/bmcapi/servers/servers_action_provision.json b/tests/payloads/bmcapi/servers/servers_action_provision.json index bc0737d8..5ebe1a9b 100644 --- a/tests/payloads/bmcapi/servers/servers_action_provision.json +++ b/tests/payloads/bmcapi/servers/servers_action_provision.json @@ -42,7 +42,8 @@ "172.217.22.14", "10.111.14.40/29", "10.111.14.66 - 10.111.14.71" - ] + ], + "bringYourOwnLicense": false }, "managementAccessAllowedIps": [ "172.217.22.14", @@ -164,7 +165,8 @@ "172.217.22.14", "10.111.14.40/29", "10.111.14.66 - 10.111.14.71" - ] + ], + "bringYourOwnLicense": false }, "rootPassword": "MyP@ssw0rd_01", "managementUiUrl": "https://172.217.22.14", diff --git a/tests/payloads/bmcapi/servers/servers_action_reset.json b/tests/payloads/bmcapi/servers/servers_action_reset.json index f60e0ed4..6f45635f 100644 --- a/tests/payloads/bmcapi/servers/servers_action_reset.json +++ b/tests/payloads/bmcapi/servers/servers_action_reset.json @@ -13,7 +13,8 @@ "sshKeyIds": [ "5fa942e71c16abcfbead275f" ], "osConfiguration": { "windows": { - "rdpAllowedIps": [ "172.217.22.14" ] + "rdpAllowedIps": [ "172.217.22.14" ], + "bringYourOwnLicense": false }, "esxi": { "managementAccessAllowedIps": [ "172.217.22.14" ] @@ -33,7 +34,8 @@ "password" : "MyP@ssw0rd_01", "osConfiguration" : { "windows": { - "rdpAllowedIps": [ "172.217.22.14" ] + "rdpAllowedIps": [ "172.217.22.14" ], + "bringYourOwnLicense": false }, "esxi": { "rootPassword": "MyP@ssw0rd_01", diff --git a/tests/payloads/bmcapi/servers/servers_post.json b/tests/payloads/bmcapi/servers/servers_post.json index 0eb18002..8f429939 100644 --- a/tests/payloads/bmcapi/servers/servers_post.json +++ b/tests/payloads/bmcapi/servers/servers_post.json @@ -41,7 +41,8 @@ "172.217.22.14", "10.111.14.40/29", "10.111.14.66 - 10.111.14.71" - ] + ], + "bringYourOwnLicense": false }, "managementAccessAllowedIps": [ "172.217.22.14", @@ -152,7 +153,8 @@ "172.217.22.14", "10.111.14.40/29", "10.111.14.66 - 10.111.14.71" - ] + ], + "bringYourOwnLicense": false }, "rootPassword": "MyP@ssw0rd_01", "managementUiUrl": "https://172.217.22.14", diff --git a/tests/payloads/networkapi/bgp_peer_groups_delete_by_id.json b/tests/payloads/networkapi/bgp_peer_groups_delete_by_id.json index b748ea1c..181e9c24 100644 --- a/tests/payloads/networkapi/bgp_peer_groups_delete_by_id.json +++ b/tests/payloads/networkapi/bgp_peer_groups_delete_by_id.json @@ -23,6 +23,25 @@ "inUse": false } ], + "ipPrefixes": [ + { + "ipAllocationId": "6047127fed34ecc3ba8402d2", + "cidr": "10.111.14.40/29", + "status": "READY", + "isBringYourOwnIp": false, + "inUse": false, + "ipVersion": "v6" + } + ], + "ipv6Prefixes": [ + { + "ipv4AllocationId": "6047127fed34ecc3ba8402d2", + "cidr": "10.111.14.40/29", + "status": "READY", + "isBringYourOwnIp": false, + "inUse": false + } + ], "targetAsnDetails": { "asn": 9131072, "isBringYourOwn": true, @@ -42,6 +61,10 @@ "peeringLoopbacksV4": [ "test" ], + "peeringLoopbacksV6": [ + "1000::", + "1000::" + ], "keepAliveTimerSeconds": 3600, "holdTimerSeconds": 7200, "createdOn": "2022-04-07T13:20:30.491Z", diff --git a/tests/payloads/networkapi/bgp_peer_groups_get.json b/tests/payloads/networkapi/bgp_peer_groups_get.json index 590df249..85d2a518 100644 --- a/tests/payloads/networkapi/bgp_peer_groups_get.json +++ b/tests/payloads/networkapi/bgp_peer_groups_get.json @@ -27,6 +27,25 @@ "inUse": false } ], + "ipPrefixes": [ + { + "ipAllocationId": "6047127fed34ecc3ba8402d2", + "cidr": "10.111.14.40/29", + "status": "READY", + "isBringYourOwnIp": false, + "inUse": false, + "ipVersion": "v6" + } + ], + "ipv6Prefixes": [ + { + "ipv4AllocationId": "6047127fed34ecc3ba8402d2", + "cidr": "10.111.14.40/29", + "status": "READY", + "isBringYourOwnIp": false, + "inUse": false + } + ], "targetAsnDetails": { "asn": 9131072, "isBringYourOwn": true, @@ -46,6 +65,10 @@ "peeringLoopbacksV4": [ "test" ], + "peeringLoopbacksV6": [ + "1000::", + "1000::" + ], "keepAliveTimerSeconds": 3600, "holdTimerSeconds": 7200, "createdOn": "2022-04-07T13:20:30.491Z", diff --git a/tests/payloads/networkapi/bgp_peer_groups_get_by_id.json b/tests/payloads/networkapi/bgp_peer_groups_get_by_id.json index 5f2a27b7..1220c160 100644 --- a/tests/payloads/networkapi/bgp_peer_groups_get_by_id.json +++ b/tests/payloads/networkapi/bgp_peer_groups_get_by_id.json @@ -23,6 +23,25 @@ "inUse": false } ], + "ipPrefixes": [ + { + "ipAllocationId": "6047127fed34ecc3ba8402d2", + "cidr": "10.111.14.40/29", + "status": "READY", + "isBringYourOwnIp": false, + "inUse": false, + "ipVersion": "v6" + } + ], + "ipv6Prefixes": [ + { + "ipv4AllocationId": "6047127fed34ecc3ba8402d2", + "cidr": "10.111.14.40/29", + "status": "READY", + "isBringYourOwnIp": false, + "inUse": false + } + ], "targetAsnDetails": { "asn": 9131072, "isBringYourOwn": true, @@ -42,6 +61,10 @@ "peeringLoopbacksV4": [ "test" ], + "peeringLoopbacksV6": [ + "1000::", + "1000::" + ], "keepAliveTimerSeconds": 3600, "holdTimerSeconds": 7200, "createdOn": "2022-04-07T13:20:30.491Z", diff --git a/tests/payloads/networkapi/bgp_peer_groups_patch_by_id.json b/tests/payloads/networkapi/bgp_peer_groups_patch_by_id.json index eedc3ab4..c871f26c 100644 --- a/tests/payloads/networkapi/bgp_peer_groups_patch_by_id.json +++ b/tests/payloads/networkapi/bgp_peer_groups_patch_by_id.json @@ -32,6 +32,25 @@ "inUse": false } ], + "ipPrefixes": [ + { + "ipAllocationId": "6047127fed34ecc3ba8402d2", + "cidr": "10.111.14.40/29", + "status": "READY", + "isBringYourOwnIp": false, + "inUse": false, + "ipVersion": "v6" + } + ], + "ipv6Prefixes": [ + { + "ipv4AllocationId": "6047127fed34ecc3ba8402d2", + "cidr": "10.111.14.40/29", + "status": "READY", + "isBringYourOwnIp": false, + "inUse": false + } + ], "targetAsnDetails": { "asn": 9131072, "isBringYourOwn": true, @@ -51,6 +70,10 @@ "peeringLoopbacksV4": [ "test" ], + "peeringLoopbacksV6": [ + "1000::", + "1000::" + ], "keepAliveTimerSeconds": 3600, "holdTimerSeconds": 7200, "createdOn": "2022-04-07T13:20:30.491Z", diff --git a/tests/payloads/networkapi/bgp_peer_groups_post.json b/tests/payloads/networkapi/bgp_peer_groups_post.json index 02bc8d94..b2e16a92 100644 --- a/tests/payloads/networkapi/bgp_peer_groups_post.json +++ b/tests/payloads/networkapi/bgp_peer_groups_post.json @@ -28,6 +28,25 @@ "inUse": false } ], + "ipPrefixes": [ + { + "ipAllocationId": "6047127fed34ecc3ba8402d2", + "cidr": "10.111.14.40/29", + "status": "READY", + "isBringYourOwnIp": false, + "inUse": false, + "ipVersion": "v6" + } + ], + "ipv6Prefixes": [ + { + "ipv4AllocationId": "6047127fed34ecc3ba8402d2", + "cidr": "10.111.14.40/29", + "status": "READY", + "isBringYourOwnIp": false, + "inUse": false + } + ], "targetAsnDetails": { "asn": 9131072, "isBringYourOwn": true, @@ -47,6 +66,10 @@ "peeringLoopbacksV4": [ "test" ], + "peeringLoopbacksV6": [ + "1000::", + "1000::" + ], "keepAliveTimerSeconds": 3600, "holdTimerSeconds": 7200, "createdOn": "2022-04-07T13:20:30.491Z", diff --git a/tests/pnap_location_api_test.py b/tests/pnap_location_api_test.py index 8c88aa5b..b543aee1 100644 --- a/tests/pnap_location_api_test.py +++ b/tests/pnap_location_api_test.py @@ -3,7 +3,7 @@ from dateutil.parser import parse import pnap_location_api from pnap_location_api.api import locations_api -from pnap_location_api.models.location_enum import LocationEnum +from pnap_location_api.models.product_location_enum import ProductLocationEnum from pnap_location_api.models.product_category_enum import ProductCategoryEnum from test_utils import TestUtils @@ -30,7 +30,7 @@ def test_get_locations(self): opts = TestUtils.generate_query_params(request) # Changing values to be enums - opts['location'] = LocationEnum(opts['location']) + opts['location'] = ProductLocationEnum(opts['location']) opts['product_category'] = ProductCategoryEnum(opts['productCategory']) del opts['productCategory']