Skip to content

Commit

Permalink
doc: Update test_api documentation in QA Docs style
Browse files Browse the repository at this point in the history
The following tests have been updated:
  * test_DOS_blocking_system.py
  * test_bruteforce_blocking_system.py
  * test_cache.py
  * test_cors.py
  * test_drop_privileges.py
  * test_experimental_features.py
  * test_host_port.py
  * test_https.py
  * test_jwt_token_exp_timeout.py
The current scheme of the issue #1694 has been used.
Update DocGenerator/config.yaml
PEP-8 fixes

Closes: #1806
  • Loading branch information
mdengra committed Sep 9, 2021
1 parent 383033f commit a4ad6e1
Show file tree
Hide file tree
Showing 10 changed files with 430 additions and 411 deletions.
27 changes: 15 additions & 12 deletions docs/DocGenerator/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Project path: "../../tests/integration"
Output path: "../output"

Include paths:
- "../../tests/integration/test_active_response"
- "../../tests/integration/test_agentd"
- "../../tests/integration/test_analysisd"
# - "../../tests/integration/test_active_response"
# - "../../tests/integration/test_agentd"
# - "../../tests/integration/test_analysisd"
- "../../tests/integration/test_api"

Include regex:
Expand Down Expand Up @@ -47,25 +47,28 @@ Output fields:
Mandatory:
- copyright
- type
- description
- tiers
- component
- brief
- tier
- modules
- components
- path
- daemons
- os_support
- os_platform
- os_version
Optional:
- coverage
- references
- pytest_args
- tags
Test:
Mandatory:
- description
- wazuh_min_version
- parameters
- assertions
- test_input
- logging
- inputs
- input_description
- expected_output
Optional:
- parameters
- tags

Test cases field: test_cases
Test cases field: inputs
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,53 @@
type:
integration
description:
These tests will check if the DOS attacks blocking feature
of the API handled by the `apid` daemon is working properly.
brief:
These tests will check if the DOS (Denial-of-service attack) blocking feature
of the API handled by the `wazuh-apid` daemon is working properly.
tiers:
- 0
tier:
0
component:
manager
modules:
- api
components:
- manager
path:
tests/integration/test_api/test_config/test_DOS_blocking_system/
tests/integration/test_api/test_config/test_DOS_blocking_system/test_DOS_blocking_system.py
daemons:
- apid
- analysisd
- syscheckd
- wazuh-apid
- wazuh-analysisd
- wazuh-syscheckd
- wazuh-db
os_support:
- linux, centos 6
- linux, centos 7
- linux, centos 8
- linux, rhel6
- linux, rhel7
- linux, rhel8
- linux, amazon linux 1
- linux, amazon linux 2
- linux, debian buster
- linux, debian stretch
- linux, debian wheezy
- linux, ubuntu bionic
- linux, ubuntu xenial
- linux, ubuntu trusty
- linux, arch linux
coverage:
pytest_args:
os_platform:
- linux
os_version:
- Amazon Linux 1
- Amazon Linux 2
- Arch Linux
- CentOS 6
- CentOS 7
- CentOS 8
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 6
- Red Hat 7
- Red Hat 8
- Ubuntu Bionic
- Ubuntu Trusty
- Ubuntu Xenial
references:
- https://documentation.wazuh.com/current/user-manual/api/getting-started.html
- https://documentation.wazuh.com/current/user-manual/api/configuration.html#access
- https://en.wikipedia.org/wiki/Denial-of-service_attack
tags:
- api
Expand Down Expand Up @@ -88,50 +96,45 @@ def test_DOS_blocking_system(tags_to_apply, get_configuration, configure_api_env
wait_for_start, get_api_details):
'''
description:
Verify that the blocking system for IPs detected as DOS attack works.
For this purpose, the test causes an IP blocking, make a request
within the same minute, make a request after the minute.
Verify that the blocking system for IP addresses detected as DOS attack works.
For this purpose, the test causes an IP blocking, makes a request within
the same minute, makes a request after the minute.
wazuh_min_version:
4.1
4.2
parameters:
- tags_to_apply:
type: set
brief: Run test if match with a configuration identifier, skip otherwise.
- get_configuration:
type: fixture
brief: Get configurations from the module.
- configure_api_environment:
type: fixture
brief: Configure a custom environment for API testing.
- restart_api:
type: fixture
brief: Reset `api.log` and start a new monitor.
- wait_for_start:
type: fixture
brief: Wait until the API starts.
- get_api_details:
type: fixture
brief: Get API information.
assertions:
- Verify that the IP is blocked using multiple request.
- Check if the IP is still blocked within the one-minute block time.
- Verify that the IP is not blocked when expires the block time.
- Verify that the IP address is blocked using multiple requests.
- Verify that the IP address is still blocked within the one-minute block time.
- Verify that the IP address is not blocked when expires the blocking time.
test_input:
input_description:
Different test cases are contained in an external `YAML` file (conf.yaml)
which includes API configuration parameters.
logging:
- api.log:
- Requests made to the API should be logged.
expected_output:
- r'429' ('Too Many Requests' HTTP status code)
- r'200' ('OK' HTTP status code)
tags:
- dos_attack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,52 @@
type:
integration
description:
These tests will check if the IP blocking feature of the API handled by the `apid` daemon is working properly.
brief:
These tests will check if the IP blocking feature of the API handled
by the `wazuh-apid` daemon is working properly.
tiers:
- 0
tier:
0
component:
manager
modules:
- api
components:
- manager
path:
tests/integration/test_api/test_config/test_bruteforce_blocking_system/
tests/integration/test_api/test_config/test_bruteforce_blocking_system/test_bruteforce_blocking_system.py
daemons:
- apid
- analysisd
- syscheckd
- wazuh-apid
- wazuh-analysisd
- wazuh-syscheckd
- wazuh-db
os_support:
- linux, centos 6
- linux, centos 7
- linux, centos 8
- linux, rhel6
- linux, rhel7
- linux, rhel8
- linux, amazon linux 1
- linux, amazon linux 2
- linux, debian buster
- linux, debian stretch
- linux, debian wheezy
- linux, ubuntu bionic
- linux, ubuntu xenial
- linux, ubuntu trusty
- linux, arch linux
coverage:
pytest_args:
os_platform:
- linux
os_version:
- Amazon Linux 1
- Amazon Linux 2
- Arch Linux
- CentOS 6
- CentOS 7
- CentOS 8
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 6
- Red Hat 7
- Red Hat 8
- Ubuntu Bionic
- Ubuntu Trusty
- Ubuntu Xenial
references:
- https://documentation.wazuh.com/current/user-manual/api/getting-started.html
- https://documentation.wazuh.com/current/user-manual/api/configuration.html#access
tags:
- api
Expand Down Expand Up @@ -86,49 +94,44 @@ def test_bruteforce_blocking_system(tags_to_apply, get_configuration, configure_
wait_for_start, get_api_details):
'''
description:
Check that the blocking time for IPs detected as brute-force attack works.
Check that the blocking time for IP addresses detected as brute-force attack works.
For this purpose, the test causes an IP blocking, make a request before
the blocking time finishes and one after the blocking time.
wazuh_min_version:
4.1
4.2
parameters:
- tags_to_apply:
type: set
brief: Run test if match with a configuration identifier, skip otherwise.
- get_configuration:
type: fixture
brief: Get configurations from the module.
- configure_api_environment:
type: fixture
brief: Configure a custom environment for API testing.
- restart_api:
type: fixture
brief: Reset `api.log` and start a new monitor.
- wait_for_start:
type: fixture
brief: Wait until the API starts.
- get_api_details:
type: fixture
brief: Get API information.
assertions:
- Check if the IP is blocked using incorrect credentials.
- Check that the IP is still blocked even when using the correct credentials within the block time.
- Verify that the IP address is blocked using incorrect credentials.
- Verify that the IP address is still blocked even when using
the correct credentials within the blocking time.
test_input:
input_description:
Different test cases are contained in an external `YAML` file (conf.yaml)
which includes API configuration parameters.
logging:
- api.log:
- Requests made to the API should be logged.
expected_output:
- r"Error obtaining login token"
tags:
- brute_force_attack
Expand Down
Loading

0 comments on commit a4ad6e1

Please sign in to comment.