Skip to content

Create unit tests for main.py #806

@mitchelbaker-cisa

Description

@mitchelbaker-cisa

Prerequisites

  • This issue has an informative and human-readable title.

💡 Summary

Create a new function, test_main.py, which will house the unit tests for the main.py function.

The test_main.py function should be stored inside of the scubagoggles/Testing/Python directory.

scubagoggles

  • Testing
    • Functional
    • Rego
    • Python
      • test_main.py

Motivation and context

This issue is in relation to epic #330

Implementation notes

We will use the pytest library for implementing unit tests and use a class-based approach for the file structure.

For the test_dive* methods, use the unittest library's built-in mocker functionality to mock each scubagoggles subcommand, e.g. gws, setup, etc.

class TestMain

  • test_get_gws_args_adds_expected_arguments(self, ...)
  • test_get_opa_args_adds_expected_arguments(self, ...)
  • test_get_setup_args_adds_expected_arguments(self, ...)
  • test_get_purge_args_adds_expected_arguments(self, ...)
  • test_get_version_args_adds_expected_arguments(self, ...)
  • test_log_level_normalizes_abbreviations(self, ...)
  • test_log_level_raises_error_on_invalid_input(self, ...)
  • test_dive_dispatches_to_gws(self, ...)
  • test_dive_dispatches_to_getopa(self, ...)
  • test_dive_dispatches_to_purge(self, ...)
  • test_dive_dispatches_to_setup(self, ...)
  • test_dive_dispatches_to_version(self, ...)

Acceptance criteria

  • The test_main.py function is added
  • TestMain class is implemented with methods that test the required behavior for each function declared in main.py

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions