47 lines
1.7 KiB
Bash
47 lines
1.7 KiB
Bash
#!/usr/bin/env bash
|
|
set -Eeuox pipefail
|
|
|
|
banner() {
|
|
echo "========================================================"
|
|
echo " $*"
|
|
echo "========================================================"
|
|
}
|
|
|
|
# Test script for activities functionality
|
|
|
|
banner "Testing Activities Functionality"
|
|
|
|
# Check if we have test files
|
|
if [ ! -d "local/test-data" ] || [ -z "$(ls -A local/test-data/*.fit 2>/dev/null)" ]; then
|
|
echo "Error: No test .fit files found in local/test-data/"
|
|
echo "Please ensure test files are available."
|
|
exit 1
|
|
fi
|
|
|
|
# Test 1: Try upload without authentication (should fail)
|
|
banner "Test 1: Upload without authentication (should fail)"
|
|
echo "This should show an authentication error:"
|
|
uv run taiga activities upload local/test-data/test.fit || echo "Expected failure - not authenticated"
|
|
|
|
# Test 2: Login first
|
|
banner "Test 2: Login with test user"
|
|
uv run taiga login --email "test@example.com" --password "test"
|
|
|
|
# Test 3: Upload a file (should succeed)
|
|
banner "Test 3: Upload test file (should succeed)"
|
|
uv run taiga activities upload local/test-data/test.fit
|
|
|
|
# Test 4: List activities (should show uploaded file)
|
|
banner "Test 4: List activities (should show uploaded file)"
|
|
uv run taiga activities ls
|
|
|
|
# Test 5: Try uploading non-existent file (should fail)
|
|
banner "Test 5: Upload non-existent file (should fail)"
|
|
uv run taiga activities upload nonexistent.fit || echo "Expected failure - file not found"
|
|
|
|
# Test 6: Try download (note: this may fail if server doesn't support download endpoint yet)
|
|
banner "Test 6: Download test (may fail if endpoint not implemented)"
|
|
uv run taiga activities download 1 --output downloaded_activity.fit || echo "Expected failure - download endpoint may not be implemented yet"
|
|
|
|
banner "Activities testing complete!"
|