50 lines
1.2 KiB
Bash
50 lines
1.2 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
# Copyright ReachableCEO Enterprises 2025
|
||
|
# Licensed under the GNU Affero General Public License v3.0
|
||
|
|
||
|
# Enable strict mode
|
||
|
set -euo pipefail
|
||
|
IFS=$'\n\t'
|
||
|
|
||
|
# Test Suite for DSR-InstrumentedCTO-RedmineGather
|
||
|
|
||
|
# Variables
|
||
|
LOG_FILE="test-LOG-DSR-InstrumentedCTO-RedmineGather-12-20-2024-21-34-25.log"
|
||
|
|
||
|
# Logging functions for tests
|
||
|
log_info() {
|
||
|
local msg="$1"
|
||
|
echo -e "\033[32m[INFO] $(date '+%m-%d-%Y-%H-%M-%S') $msg\033[0m" | tee -a "$LOG_FILE"
|
||
|
}
|
||
|
|
||
|
log_error() {
|
||
|
local msg="$1"
|
||
|
echo -e "\033[31m[ERROR] $(date '+%m-%d-%Y-%H-%M-%S') $msg\033[0m" | tee -a "$LOG_FILE" >&2
|
||
|
}
|
||
|
|
||
|
# Test for gather_redmine_data
|
||
|
test_gather_redmine_data() {
|
||
|
log_info "Testing gather_redmine_data function..."
|
||
|
|
||
|
# Mock Redmine API response
|
||
|
local mock_response='{"issues": []}'
|
||
|
echo "$mock_response" > redmine_data.json
|
||
|
|
||
|
if [[ -f redmine_data.json ]]; then
|
||
|
log_info "Test passed: Data file created."
|
||
|
else
|
||
|
log_error "Test failed: Data file not created."
|
||
|
exit 1
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
# Run all tests
|
||
|
main() {
|
||
|
log_info "Running tests for DSR-InstrumentedCTO-RedmineGather..."
|
||
|
test_gather_redmine_data
|
||
|
log_info "All tests passed."
|
||
|
}
|
||
|
|
||
|
main
|