Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
50288c2
Added API models and endpoints to reboot and halt the system, updated…
jaredhendrickson13 Jan 31, 2021
c9ce10c
Added API models and endpoints to reboot and halt the system, updated…
jaredhendrickson13 Jan 31, 2021
a954106
Bumped port version to 1.2.0
jaredhendrickson13 Jan 31, 2021
bf5f8e9
Merge pull request #69 from jaredhendrickson13/reboot_shutdown_endpoint
jaredhendrickson13 Feb 3, 2021
7c46fb3
Created API model to update API configuration, updated system API end…
jaredhendrickson13 Feb 4, 2021
7cca7e5
Created API model to update API configuration, updated system API end…
jaredhendrickson13 Feb 4, 2021
b415177
Removed docgen footer from README.md
jaredhendrickson13 Feb 4, 2021
5166401
Merge pull request #70 from jaredhendrickson13/update_api_endpoint
jaredhendrickson13 Feb 4, 2021
ab0613e
Added API models to update NTP settings, create NTP timeservers, and …
jaredhendrickson13 Feb 4, 2021
0bbd067
Fixed timeserver limit constraint in APIServicesNTPdTimeServerCreate.…
jaredhendrickson13 Feb 5, 2021
de5285f
Created NTP endpoints
jaredhendrickson13 Feb 8, 2021
d1711e7
Removed pycache directory
jaredhendrickson13 Feb 8, 2021
ab21a52
Merge pull request #78 from jaredhendrickson13/service_ntp_endpoint
jaredhendrickson13 Feb 22, 2021
be36244
Fixed merge conflict with APIResponse.inc, removed old Makefile and p…
jaredhendrickson13 Feb 23, 2021
d50f26a
Merge branch 'master' into v120
jaredhendrickson13 Feb 23, 2021
3ddd701
Cleaned up the APIFirewallStatesSizeRead.inc model class to be more e…
jaredhendrickson13 Feb 24, 2021
d91ef11
Merge branch 'v120' of github.com:jaredhendrickson13/pfsense-api into…
jaredhendrickson13 Feb 24, 2021
f468aab
Merge pull request #87 from jaredhendrickson13/fw_state_size
jaredhendrickson13 Feb 24, 2021
2ee9f48
Converted API settings UI to native pfSense framework, added advanced…
jaredhendrickson13 Feb 24, 2021
87f0806
Removed pycache
jaredhendrickson13 Feb 24, 2021
6688a07
Overhauled UI to be more pfSense-like and organized, added custom_hea…
jaredhendrickson13 Feb 24, 2021
4afe54f
Merge pull request #88 from jaredhendrickson13/ui_upgrades
jaredhendrickson13 Feb 25, 2021
340ab54
Create API model APIUserAuthServerRADIUSCreate.inc to create RADIUS a…
jaredhendrickson13 Mar 2, 2021
e8a0c3d
Added simple unit test for the create and delete RADIUS auth server f…
jaredhendrickson13 Mar 2, 2021
9d45b58
Added snippet to docs about obtaining object IDs
jaredhendrickson13 Mar 2, 2021
e85e683
Merge branch 'master' into v120
jaredhendrickson13 Mar 4, 2021
8ebdaa2
Revised unit test framework to allow for more specific test conditions
jaredhendrickson13 Mar 8, 2021
4579c5c
Added names for individual unit tests, added additional tests for som…
jaredhendrickson13 Mar 8, 2021
7f08193
Revised firewall rule unit test to be more specific, fixed incorrect …
jaredhendrickson13 Mar 8, 2021
743cb4f
Updated unit test for forthcoming user endpoint enhancements
jaredhendrickson13 Mar 11, 2021
b3bc9e6
Added the ability for virtual IPs to respond to API requests when spe…
jaredhendrickson13 Mar 11, 2021
9f2b51c
Fixed allowed_interfaces select input on API settings to correctly sh…
jaredhendrickson13 Mar 11, 2021
7d29ce8
Merge pull request #101 from jaredhendrickson13/vip_api
jaredhendrickson13 Mar 11, 2021
6996f90
Updated unit test for forthcoming virtual IP endpoint enhancements
jaredhendrickson13 Mar 11, 2021
5afa9e9
Merge branch 'v120' of github.com:jaredhendrickson13/pfsense-api into…
jaredhendrickson13 Mar 11, 2021
b7c2c5d
Added APIFirewallTrafficShaperCreate model to create new traffic shap…
jaredhendrickson13 Mar 11, 2021
afa09c4
Created unit test for /api/v1/firewall/traffic_shaper endpoint
jaredhendrickson13 Mar 11, 2021
ed884cc
Added APIFirewallTrafficShaperRead model to read all configured traff…
jaredhendrickson13 Mar 12, 2021
97e8230
Added APIFirewallTrafficShaperUpdate model to update traffic shaper o…
jaredhendrickson13 Mar 12, 2021
d48f938
Added APIFirewallTrafficShaperDelete to delete the traffic shaper of …
jaredhendrickson13 Mar 12, 2021
ada39b1
Created APIFirewallTrafficShaperQueueCreate model to create new traff…
jaredhendrickson13 Mar 12, 2021
5c4a509
Created APIFirewallTrafficShaperQueueCreate to create traffic shaper …
jaredhendrickson13 Mar 13, 2021
19db858
Merge branch 'master' into v120
jaredhendrickson13 Mar 13, 2021
39c4e13
Merge branch 'v120' into fw_shaper_api
jaredhendrickson13 Mar 13, 2021
bd6c4f4
Added APIFirewallTrafficShaperQueueDelete model to delete existing qu…
jaredhendrickson13 Mar 13, 2021
5330b56
Minor adjustments to APIFirewallTrafficShaperQueueCreate model and ad…
jaredhendrickson13 Mar 13, 2021
5b7349d
Added endpoint to add and delete firewall schedule time ranges, added…
jaredhendrickson13 Mar 14, 2021
2c444a8
Added the sched field to firewall rule creations and updates to apply…
jaredhendrickson13 Mar 14, 2021
f74c73b
Created APIFirewallScheduleUpdate model to update existing schedules,…
jaredhendrickson13 Mar 15, 2021
02dccf1
Updated and regenerated documentation
jaredhendrickson13 Mar 15, 2021
b2cda02
Minor adjustments to documentation
jaredhendrickson13 Mar 15, 2021
5739752
Added APIFirewallTrafficShaperLimiterCreate and APIFirewallTrafficSha…
jaredhendrickson13 Mar 16, 2021
b80e463
Created APIFirewallTrafficShaperDelete and APIFirewallTrafficShaperDe…
jaredhendrickson13 Mar 16, 2021
3ce4b59
Created APIFirewallTrafficShaperBandwidthDelete model and APIFirewall…
jaredhendrickson13 Mar 16, 2021
ed7b047
Added endpoint /api/v1/firewall/traffic_shaper/limiter/queue to add a…
jaredhendrickson13 Mar 17, 2021
8d36b1d
Updated documentation
jaredhendrickson13 Mar 17, 2021
9140b09
Fixed documentation typos, regenerated documentation using old Postma…
jaredhendrickson13 Mar 17, 2021
57fc7a6
Fixed revert example in docs
jaredhendrickson13 Mar 17, 2021
c3f4a26
Regenerated docs
jaredhendrickson13 Mar 17, 2021
f6637b4
Added dnpipe, pdnpipe, defaultqueue and ackqueue fields to firewall r…
jaredhendrickson13 Mar 18, 2021
c285e12
Merge pull request #108 from jaredhendrickson13/fw_shaper_api
jaredhendrickson13 Mar 18, 2021
bb87d2f
Added documentation snippet about gateway endpoint discrepancy
jaredhendrickson13 Mar 23, 2021
4caf0b9
Enhanced make_package.py to automate the process more
jaredhendrickson13 Mar 23, 2021
70f38ed
Removed virtual environments
jaredhendrickson13 Mar 23, 2021
7727ae7
Fixed bad version declaration in make_package.py
jaredhendrickson13 Mar 23, 2021
e5b0f4a
Swapped port version/revision
jaredhendrickson13 Mar 23, 2021
e8aa6cd
Fixed package path
jaredhendrickson13 Mar 23, 2021
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
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: jaredhendrickson13
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.idea
*/__pycache__/
tests/unit_test_framework/__pycache__/
*.DS_Store
.phplint-cache

1,390 changes: 1,336 additions & 54 deletions README.md

Large diffs are not rendered by default.

139 changes: 100 additions & 39 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,43 +371,68 @@ class NewAPIUnitTest(unit_test_framework.APIUnitTest):
#### Overriding Base Model Properties ####
The APIUnitTest class requires you to override a some properties to function correctly:

- `url` : A string specifying the URL this unit test will be testing<br>
- `get_payloads` : A list of dictionary formatted API payloads to use when testing GET requests. If this endpoint does not
support GET requests, you do not need to override this property. If this endpoint does support GET request, but does not
require any payload data to receive a valid response you must set this value to `[{}]`
- `post_payloads` : A list of dictionary formatted API payloads to use when testing POST requests. If this endpoint does
not support POST requests, you do not need to override this property.
- `put_payloads` : A list of dictionary formatted API payloads to use when testing PUT requests. If this endpoint does
not support PUT requests, you do not need to override this property.
- `delete_payloads` : A list of dictionary formatted API payloads to use when testing DELETE requests. If this endpoint does
not support DELETE requests, you do not need to override this property.
- `url` : A string specifying the URL this unit test will be testing
- `time_delay` : An integer specifying how many seconds should be waited between requests. Defaults to `1`.
- `get_tests` : A list of dictionary formatted test parameters for GET requests. If this endpoint does not support
GET requests, you do not need to override this property. If this endpoint does support GET request, but does not require
any payload data to receive a valid response you must set this value to `[{}]`. Each dictionary can contain:
- `name` : set a descriptive name to be printed alongside test results (defaults to `unnamed test`)
- `payload` : a nested dictionary that contains the request payload to use when running the test (defaults to `{}`)
- `status` : an integer that specifies the tests expected HTTPS status code (defaults to `200`)
- `return` : an integer that specifies the tests expected API return code (defaults to `0`)
- `resp_time` : a float that specifies the tests maximum response time expected from the API endpoint
- `auth_payload` : a dictionary containing authentication payload values (typically `client-id` and `client-token`)
to use with the corresponding request (defaults the username and password passed into the command)

- `post_tests` : A list of dictionary formatted test parameters for POST requests. If this endpoint does not support
POST requests, you do not need to override this property. If this endpoint does support POST request, but does not require
any payload data to receive a valid response you must set this value to `[{}]`. Each dictionary can contain:
- `name` : set a descriptive name to be printed alongside test results (defaults to `unnamed test`)
- `payload` : a nested dictionary that contains the request payload to use when running the test (defaults to `{}`)
- `status` : an integer that specifies the tests expected HTTPS status code (defaults to `200`)
- `return` : an integer that specifies the tests expected API return code (defaults to `0`)
- `resp_time` : a float that specifies the tests maximum response time expected from the API endpoint
- `auth_payload` : a dictionary containing authentication payload values (typically `client-id` and `client-token`)
to use with the corresponding request (defaults the username and password passed into the command)

- `put_tests` : A list of dictionary formatted test parameters for PUT requests. If this endpoint does not support
PUT requests, you do not need to override this property. If this endpoint does support PUT request, but does not require
any payload data to receive a valid response you must set this value to `[{}]`. Each dictionary can contain:
- `name` : set a descriptive name to be printed alongside test results (defaults to `unnamed test`)
- `payload` : a nested dictionary that contains the request payload to use when running the test (defaults to `{}`)
- `status` : an integer that specifies the tests expected HTTPS status code (defaults to `200`)
- `return` : an integer that specifies the tests expected API return code (defaults to `0`)
- `resp_time` : a float that specifies the tests maximum response time expected from the API endpoint
- `auth_payload` : a dictionary containing authentication payload values (typically `client-id` and `client-token`)
to use with the corresponding request (defaults the username and password passed into the command)

- `delete_tests` : A list of dictionary formatted test parameters for DELETE requests. If this endpoint does not support
DELETE requests, you do not need to override this property. If this endpoint does support DELETE request, but does not require
any payload data to receive a valid response you must set this value to `[{}]`. Each dictionary can contain:
- `name` : set a descriptive name to be printed alongside test results (defaults to `unnamed test`)
- `payload` : a nested dictionary that contains the request payload to use when running the test (defaults to `{}`)
- `status` : an integer that specifies the tests expected HTTPS status code (defaults to `200`)
- `return` : an integer that specifies the tests expected API return code (defaults to `0`)
- `resp_time` : a float that specifies the tests maximum response time expected from the API endpoint
- `auth_payload` : a dictionary containing authentication payload values (typically `client-id` and `client-token`)
to use with the corresponding request (defaults the username and password passed into the command)

- `get_responses` : A list of previously executed GET requests in a dictionary format. Failing responses will not be
included.

- `post_responses` : A list of previously executed POST requests in a dictionary format. Failing responses will not be
included.

- `put_responses` : A list of previously executed PUT requests in a dictionary format. Failing responses will not be
included.

- `delete_responses` : A list of previously executed DELETE requests in a dictionary format. Failing responses will not be
included.

```python
import unit_test_framework
#### Other Base Model Properties
The APIUnitTest class also contains a few properties that are not intended to be overridden:

class NewAPIUnitTest(unit_test_framework.APIUnitTest):
url = "/api/v1/your_endpoint"
get_payloads = [{}]
post_payloads = [
{"some_parameter": "some value to create"},
{"some_parameter": "some other value to create"}
]
put_payloads = [
{"some_parameter": "some value to update"},
{"some_parameter": "some other value to update"}
]
delete_payloads = [
{"some_parameter": "some value to delete"},
]
```
- `uid` : a unique ID that can be used for payload fields that required a unique value

#### Overriding Base Model Methods ####
There are methods that will assist you when you need to dynamically format API request data. These are typically used
Expand All @@ -432,18 +457,52 @@ import unit_test_framework

class NewAPIUnitTest(unit_test_framework.APIUnitTest):
url = "/api/v1/your_endpoint"
get_payloads = [{}]
post_payloads = [
{"some_parameter": "some value to create"},
{"some_parameter": "some other value to create"}
]
put_payloads = [
{"some_parameter": "some value to update"},
{"some_parameter": "some other value to update"}
get_requests = [{}]
post_requests = [
{
"payload": {
"some_parameter": "some value to create"
},
"status": 400,
"return": 1,
"resp_time": 0.5
},
{
"payload": {
"some_other parameter": "some other value to create"
},
"status": 200,
"return": 0,
"resp_time": 0.6
}, ]
put_requests = [
{
"payload": {
"some_parameter": "some value to update"
},
"status": 400,
"return": 1,
"resp_time": 0.5
},
{
"payload": {
"some_other parameter": "some other value to update"
},
"status": 200,
"return": 0,
"resp_time": 0.6
},
]
delete_payloads = [
{"some_parameter": "some value to delete"},
]
delete_requests = [
{
"payload": {
"some_parameter": "some value to delete"
},
"status": 200,
"return": 0,
"resp_time": 0.5
},
]

NewAPIUnitTest()
```
Expand All @@ -457,7 +516,9 @@ Or you may run all the unit tests by running:<br>
Unit tests will check API responses for the following:
- Ability to connect to API endpoint
- API responses properly return data in a JSON format
- API payloads return a 200 OK response
- API responses include the correct HTTP status code
- API responses include the expected API return code
- API responses are received within an acceptable time frame
- CRUD success. POST requests are always run first, then GET requests to check that the creation was successful, then
PUT requests attempt to update the created object, then finally DELETE requests attempt to destroy the object.

Expand Down
2,400 changes: 2,209 additions & 191 deletions docs/documentation.json

Large diffs are not rendered by default.

Loading