bicep_utils.tests package

Submodules

bicep_utils.tests.test_general_utilities module

app.bicep_utils.tests.test_general_utilities.temp_file(tmp_path)[source]
async app.bicep_utils.tests.test_general_utilities.test_create_and_activate_network_interface(mock_execute_command)[source]
async app.bicep_utils.tests.test_general_utilities.test_get_env_variable(monkeypatch)[source]
async app.bicep_utils.tests.test_general_utilities.test_mirror_network_traffic_to_interface(mock_execute_command)[source]
async app.bicep_utils.tests.test_general_utilities.test_remove_network_interface(mock_execute_command)[source]
async app.bicep_utils.tests.test_general_utilities.test_save_file(temp_file)[source]
async app.bicep_utils.tests.test_general_utilities.test_stop_process(mock_process_class)[source]
async app.bicep_utils.tests.test_general_utilities.test_wait_for_process_completion(mock_process_class)[source]

bicep_utils.tests.test_model module

class app.bicep_utils.tests.test_model.MockIDS(container_id: int = None, container_name: str = None, ensemble_id: int = None, pids: list[int] = [], dataset_id: int = None, static_analysis_running: bool = False, send_alerts_periodically_task=None, tap_interface_name: str = None, background_tasks: set = {})[source]

Bases: IDSBase

async configuration_location()[source]

Abstract property specifying the configuration location.

async configure(file_path)[source]

Configures the IDS with the provided configuration file. E.g. placing the configuration in the correct location.

Parameters:

file_path (str) – Path to the configuration file.

Returns:

str – Confirmation message.

async configure_ruleset(file_path)[source]

Configures the IDS ruleset with the provided file. If not ruleset is required for the IDS, simply return a confirmation message saying so.

Parameters:

file_path (str) – Path to the ruleset file.

Returns:

str – Confirmation message.

async execute_network_analysis_command()[source]

Method that takes all actions necessary to execute the IDS command for a network analysis on the self.tap_interface.

Returns:

int – Process ID of the spawned IDS process.

async execute_static_analysis_command(file_path: str)[source]

Executes the IDS command for static analysis using a pcap file.

Parameters:

file_path (str) – Path to the pcap file.

Returns:

int – Process ID of the spawned IDS process.

async log_location()[source]

Abstract property specifying the log location.

async parser()[source]

Abstract property to reference the repsective IDS Parser.

app.bicep_utils.tests.test_model.mock_alert_list()[source]
app.bicep_utils.tests.test_model.mock_ids(mock_alert_list)[source]
async app.bicep_utils.tests.test_model.test_alerts_from_json_with_double_quotes()[source]
async app.bicep_utils.tests.test_model.test_finish_static_analysis_in_background(mock_tell_core, mock_send_alerts, mock_ids: MockIDS)[source]
async app.bicep_utils.tests.test_model.test_send_alerts_to_core(mock_post, mock_get_env_variable, mock_ids: MockIDS)[source]
async app.bicep_utils.tests.test_model.test_send_alerts_to_core_ensemble(mock_post, mock_get_env_variable, mock_ids: MockIDS)[source]
async app.bicep_utils.tests.test_model.test_send_alerts_to_core_periodically(mock_post, mock_get_env_variable, mock_ids: MockIDS)[source]
async app.bicep_utils.tests.test_model.test_send_alerts_to_core_periodically_ensemble(mock_post, mock_get_env_variable, mock_ids: MockIDS)[source]
async app.bicep_utils.tests.test_model.test_send_alerts_to_core_periodically_exception(mock_post, mock_get_env_variable, mock_ids: MockIDS)[source]
async app.bicep_utils.tests.test_model.test_start_network_analysis(mock_mirror, mock_create_interface, mock_ids: MockIDS)[source]
async app.bicep_utils.tests.test_model.test_start_static_analysis(mock_wait_for_process, mock_ids: MockIDS)[source]
async app.bicep_utils.tests.test_model.test_start_static_analysis_if_no_other_analysis_task_running_in_background(mock_wait_for_process, tell_core_has_finished_mock, mock_ids: MockIDS)[source]
async app.bicep_utils.tests.test_model.test_stop_all_processes(mock_stop_process, mock_ids: MockIDS)[source]
async app.bicep_utils.tests.test_model.test_stop_all_processes_without_process_numbers(mock_stop_process, mock_ids: MockIDS)[source]
async app.bicep_utils.tests.test_model.test_stop_network_analysis(mock_tell_core, mock_stop_all, mock_remove_interface, mock_ids: MockIDS)[source]
async app.bicep_utils.tests.test_model.test_stop_static_analysis(mock_tell_core, mock_stop_all, mock_ids: MockIDS)[source]
async app.bicep_utils.tests.test_model.test_tell_core_analysis_has_finished(mock_post, mock_get_env_variable, mock_ids: MockIDS)[source]
async app.bicep_utils.tests.test_model.test_tell_core_analysis_has_finished_for_ensemble(mock_post, mock_get_env_variable, mock_ids: MockIDS)[source]

bicep_utils.tests.test_routes module

app.bicep_utils.tests.test_routes.mock_ids()[source]
async app.bicep_utils.tests.test_routes.test_add_to_ensemble(mock_ids)[source]
async app.bicep_utils.tests.test_routes.test_add_to_ensemble_with_incorrect_id(mock_ids)[source]
async app.bicep_utils.tests.test_routes.test_configuration(save_file_mock, mock_ids)[source]
async app.bicep_utils.tests.test_routes.test_configuration_file_is_none(mock_ids)[source]
async app.bicep_utils.tests.test_routes.test_healthcheck()[source]
async app.bicep_utils.tests.test_routes.test_network_analysis(mock_ids)[source]
async app.bicep_utils.tests.test_routes.test_network_analysis_for_ensemble(mock_ids)[source]
async app.bicep_utils.tests.test_routes.test_remove_from_ensemble(mock_ids)[source]
async app.bicep_utils.tests.test_routes.test_ruleset(save_file_mock, mock_ids)[source]
async app.bicep_utils.tests.test_routes.test_ruleset_file_is_none(mock_ids)[source]
async app.bicep_utils.tests.test_routes.test_static_analysis(copy_mock, save_file_mock, mock_ids)[source]
async app.bicep_utils.tests.test_routes.test_static_analysis_no_file_provided(save_file_mock, mock_ids)[source]
async app.bicep_utils.tests.test_routes.test_stop_analysis(mock_ids)[source]