Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate test_office365 documentation to qa-docs #2181

Merged
merged 1 commit into from
Nov 30, 2021

Conversation

mdengra
Copy link
Contributor

@mdengra mdengra commented Nov 5, 2021

Related issue
Closes #1815

Description

As part of epic #1796, this PR adds the missing documentation and migrates the current documentation to the new format used by qa-docs.
The schema used is the one defined in issue #1694

New tags

The following tags are added to the wiki: office365_configuration

Generated documentation

test_invalid.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <info@wazuh.com>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The Wazuh 'office365' module allows you to collect all the logs from Office 365 using its API. Specifically, these tests will check if that module detects invalid configurations and indicates the location of the errors detected. The Office 365 Management Activity API aggregates actions and events into tenant-specific content blobs, which are classified by the type and source of the content they contain.",
    "tier": 0,
    "modules": [
        "office365"
    ],
    "components": [
        "manager"
    ],
    "daemons": [
        "wazuh-analysisd",
        "wazuh-monitord",
        "wazuh-modulesd"
    ],
    "os_platform": [
        "linux"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6"
    ],
    "references": [
        "https://github.com/wazuh/wazuh-documentation/blob/develop/source/office365/index.rst",
        "https://github.com/wazuh/wazuh-documentation/blob/develop/source/office365/monitoring-office365-activity.rst"
    ],
    "tags": [
        "office365_configuration"
    ],
    "name": "test_invalid.py",
    "id": 1,
    "group_id": 0,
    "tests": [
        {
            "description": "Check if the 'office365' module detects invalid configurations. For this purpose, the test will configure that module using invalid configuration settings with different attributes. Finally, it will verify that error events are generated indicating the source of the errors.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_local_internal_options": {
                        "type": "fixture",
                        "brief": "Get internal configuration."
                    }
                },
                {
                    "configure_local_internal_options": {
                        "type": "fixture",
                        "brief": "Set internal configuration for testing."
                    }
                },
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "reset_ossec_log": {
                        "type": "fixture",
                        "brief": "Reset the 'ossec.log' file and start a new monitor."
                    }
                }
            ],
            "assertions": [
                "Verify that the 'office365' module generates error events when invalid configurations are used."
            ],
            "input_description": "A configuration template (offic365_integration) is contained in an external YAML file (wazuh_conf.yaml). That template is combined with different test cases defined in the module. Those include configuration settings for the 'office365' module.",
            "expected_output": [
                {
                    "r'wm_office365_read()": "ERROR.* Invalid content for tag .*'"
                },
                {
                    "r'wm_office365_read()": "ERROR.* Empty content for tag .*'"
                }
            ],
            "tags": [
                "invalid_settings"
            ],
            "name": "test_invalid",
            "inputs": [
                "get_configuration0",
                "get_configuration1",
                "get_configuration2",
                "get_configuration3",
                "get_configuration4",
                "get_configuration5",
                "get_configuration6",
                "get_configuration7"
            ]
        }
    ]
}

test_invalid.yaml

brief: The Wazuh 'office365' module allows you to collect all the logs from Office
  365 using its API. Specifically, these tests will check if that module detects invalid
  configurations and indicates the location of the errors detected. The Office 365
  Management Activity API aggregates actions and events into tenant-specific content
  blobs, which are classified by the type and source of the content they contain.
components:
- manager
copyright: 'Copyright (C) 2015-2021, Wazuh Inc.

  Created by Wazuh, Inc. <info@wazuh.com>.

  This program is free software; you can redistribute it and/or modify it under the
  terms of GPLv2'
daemons:
- wazuh-analysisd
- wazuh-monitord
- wazuh-modulesd
group_id: 0
id: 1
modules:
- office365
name: test_invalid.py
os_platform:
- linux
os_version:
- Arch Linux
- Amazon Linux 2
- Amazon Linux 1
- CentOS 8
- CentOS 7
- CentOS 6
- Ubuntu Focal
- Ubuntu Bionic
- Ubuntu Xenial
- Ubuntu Trusty
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 8
- Red Hat 7
- Red Hat 6
references:
- https://github.com/wazuh/wazuh-documentation/blob/develop/source/office365/index.rst
- https://github.com/wazuh/wazuh-documentation/blob/develop/source/office365/monitoring-office365-activity.rst
tags:
- office365_configuration
tests:
- assertions:
  - Verify that the 'office365' module generates error events when invalid configurations
    are used.
  description: Check if the 'office365' module detects invalid configurations. For
    this purpose, the test will configure that module using invalid configuration
    settings with different attributes. Finally, it will verify that error events
    are generated indicating the source of the errors.
  expected_output:
  - r'wm_office365_read(): ERROR.* Invalid content for tag .*'
  - r'wm_office365_read(): ERROR.* Empty content for tag .*'
  input_description: A configuration template (offic365_integration) is contained
    in an external YAML file (wazuh_conf.yaml). That template is combined with different
    test cases defined in the module. Those include configuration settings for the
    'office365' module.
  inputs:
  - get_configuration0
  - get_configuration1
  - get_configuration2
  - get_configuration3
  - get_configuration4
  - get_configuration5
  - get_configuration6
  - get_configuration7
  name: test_invalid
  parameters:
  - get_local_internal_options:
      brief: Get internal configuration.
      type: fixture
  - configure_local_internal_options:
      brief: Set internal configuration for testing.
      type: fixture
  - get_configuration:
      brief: Get configurations from the module.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  - reset_ossec_log:
      brief: Reset the 'ossec.log' file and start a new monitor.
      type: fixture
  tags:
  - invalid_settings
  wazuh_min_version: 4.2.0
tier: 0
type: integration

Tests

  • Python codebase satisfies PEP-8 style style guide. pycodestyle --max-line-length=120 --show-source --show-pep8 file.py.
  • The DocGenerator sanity check test does not return errors. python3 DocGenerator.py -s

The following tests have been documentated:
  * test_invalid.py
The current scheme of the issue #1694 has been used.
PEP-8 fixes.

Related: #1815
@mdengra mdengra requested review from snaow and roronoasins November 5, 2021 11:22
@mdengra mdengra self-assigned this Nov 5, 2021
Copy link

@roronoasins roronoasins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@snaow snaow merged commit 45e74cb into master Nov 30, 2021
@snaow snaow deleted the 1815-qadocs-migrate-test-office365 branch November 30, 2021 23:08
@snaow snaow mentioned this pull request Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

qa-docs: Migrate test_office365 documentation to schema 2.0
3 participants