-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
132 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,77 +52,77 @@ jobs: | |
- name: Create superuser | ||
run: | | ||
docker exec -e DJANGO_SUPERUSER_PASSWORD="12345" yuyuwechatv2_client python manage.py createsuperuser --no-input --username testuser --email [email protected] | ||
# Login and store session cookies and CSRF token | ||
- name: Login and store session cookies | ||
run: | | ||
curl -c cookies.txt -s -d "username=testuser&password=12345" -X POST http://127.0.0.1:7500/login/ | ||
csrf_token=$(grep -oP 'csrftoken=\K[^;]+' cookies.txt) | ||
# Test endpoints with login and CSRF token | ||
- name: Test main endpoint with login and csrf token | ||
run: | | ||
curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/ | ||
- name: Test get_server_ip endpoint with login and csrf token | ||
run: | | ||
curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/get_server_ip/ | ||
- name: Test set_server_ip endpoint with login and csrf token | ||
run: | | ||
curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail -X POST -H "Content-Type: application/json" -d '{"server_ip": "127.0.0.1"}' http://127.0.0.1:7500/set_server_ip/ | ||
- name: Test schedule_management endpoint with login and csrf token | ||
run: | | ||
curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/schedule_management/ | ||
- name: Test send_message_management endpoint with login and csrf token | ||
run: | | ||
curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/send_message_management/ | ||
- name: Test start_celery endpoint with login and csrf token | ||
run: | | ||
curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail -X POST http://127.0.0.1:7500/start_celery/ | ||
- name: Wait for the celery to start | ||
run: sleep 5 | ||
|
||
- name: Test check_celery_running endpoint with login and csrf token | ||
run: | | ||
curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/check_celery_running/ | ||
- name: Test stop_celery endpoint with login and csrf token | ||
run: | | ||
curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/stop_celery/ | ||
- name: Test check_wechat_status endpoint with login and csrf token | ||
run: | | ||
curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/check_wechat_status/ | ||
- name: Test log_view endpoint with login and csrf token | ||
run: | | ||
curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/logs/ | ||
- name: Test log_counts endpoint with login and csrf token | ||
run: | | ||
curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/log_counts/ | ||
- name: Test clear_logs endpoint with login and csrf token | ||
run: | | ||
curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail -X POST http://127.0.0.1:7500/clear_logs/ | ||
- name: Test error_detection_view endpoint with login and csrf token | ||
run: | | ||
curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/error_detection/ | ||
- name: Test check_errors endpoint with login and csrf token | ||
run: | | ||
curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/check_errors/ | ||
- name: Test export_database endpoint with login and csrf token | ||
run: | | ||
curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail -X POST http://127.0.0.1:7500/export_database/ -o db_backup.json | ||
- name: Test import_database endpoint with login and csrf token | ||
run: | | ||
curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail -F "db_file=@db_backup.json" http://127.0.0.1:7500/import_database/ | ||
# | ||
# # Login and store session cookies and CSRF token | ||
# - name: Login and store session cookies | ||
# run: | | ||
# curl -c cookies.txt -s -d "username=testuser&password=12345" -X POST http://127.0.0.1:7500/login/ | ||
# csrf_token=$(grep -oP 'csrftoken=\K[^;]+' cookies.txt) | ||
# | ||
# # Test endpoints with login and CSRF token | ||
# - name: Test main endpoint with login and csrf token | ||
# run: | | ||
# curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/ | ||
# | ||
# - name: Test get_server_ip endpoint with login and csrf token | ||
# run: | | ||
# curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/get_server_ip/ | ||
# | ||
# - name: Test set_server_ip endpoint with login and csrf token | ||
# run: | | ||
# curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail -X POST -H "Content-Type: application/json" -d '{"server_ip": "127.0.0.1"}' http://127.0.0.1:7500/set_server_ip/ | ||
# | ||
# - name: Test schedule_management endpoint with login and csrf token | ||
# run: | | ||
# curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/schedule_management/ | ||
# | ||
# - name: Test send_message_management endpoint with login and csrf token | ||
# run: | | ||
# curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/send_message_management/ | ||
# | ||
# - name: Test start_celery endpoint with login and csrf token | ||
# run: | | ||
# curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail -X POST http://127.0.0.1:7500/start_celery/ | ||
# | ||
# - name: Wait for the celery to start | ||
# run: sleep 5 | ||
# | ||
# - name: Test check_celery_running endpoint with login and csrf token | ||
# run: | | ||
# curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/check_celery_running/ | ||
# | ||
# - name: Test stop_celery endpoint with login and csrf token | ||
# run: | | ||
# curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/stop_celery/ | ||
# | ||
# - name: Test check_wechat_status endpoint with login and csrf token | ||
# run: | | ||
# curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/check_wechat_status/ | ||
# | ||
# - name: Test log_view endpoint with login and csrf token | ||
# run: | | ||
# curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/logs/ | ||
# | ||
# - name: Test log_counts endpoint with login and csrf token | ||
# run: | | ||
# curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/log_counts/ | ||
# | ||
# - name: Test clear_logs endpoint with login and csrf token | ||
# run: | | ||
# curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail -X POST http://127.0.0.1:7500/clear_logs/ | ||
# | ||
# - name: Test error_detection_view endpoint with login and csrf token | ||
# run: | | ||
# curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/error_detection/ | ||
# | ||
# - name: Test check_errors endpoint with login and csrf token | ||
# run: | | ||
# curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail http://127.0.0.1:7500/check_errors/ | ||
# | ||
# - name: Test export_database endpoint with login and csrf token | ||
# run: | | ||
# curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail -X POST http://127.0.0.1:7500/export_database/ -o db_backup.json | ||
# | ||
# - name: Test import_database endpoint with login and csrf token | ||
# run: | | ||
# curl -b cookies.txt -H "X-CSRFToken: $csrf_token" --fail -F "db_file=@db_backup.json" http://127.0.0.1:7500/import_database/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,69 +84,69 @@ jobs: | |
- name: Create superuser | ||
run: | | ||
docker exec -e DJANGO_SUPERUSER_PASSWORD="12345" yuyuwechatv2_client python manage.py createsuperuser --no-input --username testuser --email [email protected] | ||
# Login and store session cookies | ||
- name: Login and store session cookies | ||
run: | | ||
curl -c cookies.txt -d "username=testuser&password=12345" -X POST http://127.0.0.1:7500/login/ | ||
# Test endpoints with login | ||
- name: Test main endpoint with login | ||
run: curl -b cookies.txt --fail http://127.0.0.1:7500/ | ||
|
||
- name: Test get_server_ip endpoint with login | ||
run: curl -b cookies.txt --fail http://127.0.0.1:7500/get_server_ip/ | ||
|
||
- name: Test set_server_ip endpoint with login | ||
run: | | ||
curl -b cookies.txt --fail -X POST -H "Content-Type: application/json" -d '{"server_ip": "127.0.0.1"}' http://127.0.0.1:7500/set_server_ip/ | ||
- name: Test schedule_management endpoint with login | ||
run: curl -b cookies.txt --fail http://127.0.0.1:7500/schedule_management/ | ||
|
||
- name: Test send_message_management endpoint with login | ||
run: curl -b cookies.txt --fail http://127.0.0.1:7500/send_message_management/ | ||
|
||
- name: Test start_celery endpoint with login | ||
run: curl -b cookies.txt --fail -X POST http://127.0.0.1:7500/start_celery/ | ||
|
||
- name: Wait for the celery to start | ||
run: sleep 5 | ||
|
||
- name: Test check_celery_running endpoint with login | ||
run: curl -b cookies.txt --fail http://127.0.0.1:7500/check_celery_running/ | ||
|
||
- name: Test stop_celery endpoint with login | ||
run: curl -b cookies.txt --fail http://127.0.0.1:7500/stop_celery/ | ||
|
||
- name: Test check_wechat_status endpoint with login | ||
run: curl -b cookies.txt --fail http://127.0.0.1:7500/check_wechat_status/ | ||
|
||
- name: Test log_view endpoint with login | ||
run: curl -b cookies.txt --fail http://127.0.0.1:7500/logs/ | ||
|
||
- name: Test log_counts endpoint with login | ||
run: curl -b cookies.txt --fail http://127.0.0.1:7500/log_counts/ | ||
|
||
- name: Test clear_logs endpoint with login | ||
run: curl -b cookies.txt --fail -X POST http://127.0.0.1:7500/clear_logs/ | ||
|
||
- name: Test error_detection_view endpoint with login | ||
run: curl -b cookies.txt --fail http://127.0.0.1:7500/error_detection/ | ||
|
||
- name: Test check_errors endpoint with login | ||
run: curl -b cookies.txt --fail http://127.0.0.1:7500/check_errors/ | ||
# | ||
# # Login and store session cookies | ||
# - name: Login and store session cookies | ||
# run: | | ||
# curl -c cookies.txt -d "username=testuser&password=12345" -X POST http://127.0.0.1:7500/login/ | ||
# | ||
# # Test endpoints with login | ||
# - name: Test main endpoint with login | ||
# run: curl -b cookies.txt --fail http://127.0.0.1:7500/ | ||
# | ||
# - name: Test get_server_ip endpoint with login | ||
# run: curl -b cookies.txt --fail http://127.0.0.1:7500/get_server_ip/ | ||
# | ||
# - name: Test set_server_ip endpoint with login | ||
# run: | | ||
# curl -b cookies.txt --fail -X POST -H "Content-Type: application/json" -d '{"server_ip": "127.0.0.1"}' http://127.0.0.1:7500/set_server_ip/ | ||
# | ||
# - name: Test schedule_management endpoint with login | ||
# run: curl -b cookies.txt --fail http://127.0.0.1:7500/schedule_management/ | ||
# | ||
# - name: Test send_message_management endpoint with login | ||
# run: curl -b cookies.txt --fail http://127.0.0.1:7500/send_message_management/ | ||
# | ||
# - name: Test start_celery endpoint with login | ||
# run: curl -b cookies.txt --fail -X POST http://127.0.0.1:7500/start_celery/ | ||
# | ||
# - name: Wait for the celery to start | ||
# run: sleep 5 | ||
# | ||
# - name: Test check_celery_running endpoint with login | ||
# run: curl -b cookies.txt --fail http://127.0.0.1:7500/check_celery_running/ | ||
# | ||
# - name: Test stop_celery endpoint with login | ||
# run: curl -b cookies.txt --fail http://127.0.0.1:7500/stop_celery/ | ||
# | ||
# - name: Test check_wechat_status endpoint with login | ||
# run: curl -b cookies.txt --fail http://127.0.0.1:7500/check_wechat_status/ | ||
# | ||
# - name: Test log_view endpoint with login | ||
# run: curl -b cookies.txt --fail http://127.0.0.1:7500/logs/ | ||
# | ||
# - name: Test log_counts endpoint with login | ||
# run: curl -b cookies.txt --fail http://127.0.0.1:7500/log_counts/ | ||
# | ||
# - name: Test clear_logs endpoint with login | ||
# run: curl -b cookies.txt --fail -X POST http://127.0.0.1:7500/clear_logs/ | ||
# | ||
# - name: Test error_detection_view endpoint with login | ||
# run: curl -b cookies.txt --fail http://127.0.0.1:7500/error_detection/ | ||
# | ||
# - name: Test check_errors endpoint with login | ||
# run: curl -b cookies.txt --fail http://127.0.0.1:7500/check_errors/ | ||
|
||
# - name: Test handle_error_cron endpoint with login | ||
# run: | | ||
# curl -b cookies.txt --fail -X POST -H "Content-Type: application/json" -d '{"action": "ignore", "task_id": 1, "correct_time": "2023-08-01 12:00:00"}' http://127.0.0.1:7500/handle_error_cron/ | ||
|
||
- name: Test export_database endpoint with login | ||
run: curl -b cookies.txt --fail -X POST http://127.0.0.1:7500/export_database/ -o db_backup.json | ||
|
||
- name: Test import_database endpoint with login | ||
run: | | ||
curl -b cookies.txt --fail -F "db_file=@db_backup.json" http://127.0.0.1:7500/import_database/ | ||
# - name: Test export_database endpoint with login | ||
# run: curl -b cookies.txt --fail -X POST http://127.0.0.1:7500/export_database/ -o db_backup.json | ||
# | ||
# - name: Test import_database endpoint with login | ||
# run: | | ||
# curl -b cookies.txt --fail -F "db_file=@db_backup.json" http://127.0.0.1:7500/import_database/ | ||
|
||
- name: Stop and remove Docker container | ||
run: docker-compose -f "./GitHub Action Build Docker.yml" down | ||
|