Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Test Results/
**/test-reports/
__pycache__
*.egg-info
*.egg-info
.venv/
4 changes: 2 additions & 2 deletions pnap_bmc_api/pnap_bmc_api/models/quota_edit_limit_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
14 changes: 13 additions & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
```

### 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.
6 changes: 4 additions & 2 deletions tests/payloads/bmcapi/servers/servers_action_provision.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 4 additions & 2 deletions tests/payloads/bmcapi/servers/servers_action_reset.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand All @@ -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",
Expand Down
6 changes: 4 additions & 2 deletions tests/payloads/bmcapi/servers/servers_post.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
23 changes: 23 additions & 0 deletions tests/payloads/networkapi/bgp_peer_groups_delete_by_id.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -42,6 +61,10 @@
"peeringLoopbacksV4": [
"test"
],
"peeringLoopbacksV6": [
"1000::",
"1000::"
],
"keepAliveTimerSeconds": 3600,
"holdTimerSeconds": 7200,
"createdOn": "2022-04-07T13:20:30.491Z",
Expand Down
23 changes: 23 additions & 0 deletions tests/payloads/networkapi/bgp_peer_groups_get.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -46,6 +65,10 @@
"peeringLoopbacksV4": [
"test"
],
"peeringLoopbacksV6": [
"1000::",
"1000::"
],
"keepAliveTimerSeconds": 3600,
"holdTimerSeconds": 7200,
"createdOn": "2022-04-07T13:20:30.491Z",
Expand Down
23 changes: 23 additions & 0 deletions tests/payloads/networkapi/bgp_peer_groups_get_by_id.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -42,6 +61,10 @@
"peeringLoopbacksV4": [
"test"
],
"peeringLoopbacksV6": [
"1000::",
"1000::"
],
"keepAliveTimerSeconds": 3600,
"holdTimerSeconds": 7200,
"createdOn": "2022-04-07T13:20:30.491Z",
Expand Down
23 changes: 23 additions & 0 deletions tests/payloads/networkapi/bgp_peer_groups_patch_by_id.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -51,6 +70,10 @@
"peeringLoopbacksV4": [
"test"
],
"peeringLoopbacksV6": [
"1000::",
"1000::"
],
"keepAliveTimerSeconds": 3600,
"holdTimerSeconds": 7200,
"createdOn": "2022-04-07T13:20:30.491Z",
Expand Down
23 changes: 23 additions & 0 deletions tests/payloads/networkapi/bgp_peer_groups_post.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -47,6 +66,10 @@
"peeringLoopbacksV4": [
"test"
],
"peeringLoopbacksV6": [
"1000::",
"1000::"
],
"keepAliveTimerSeconds": 3600,
"holdTimerSeconds": 7200,
"createdOn": "2022-04-07T13:20:30.491Z",
Expand Down
4 changes: 2 additions & 2 deletions tests/pnap_location_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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']

Expand Down
Loading