From 03e3a0c67a9d7161c555b40bd5f3375bffe2dce8 Mon Sep 17 00:00:00 2001 From: NeonCodex Agent Date: Wed, 9 Sep 2026 06:36:36 +0000 Subject: [PATCH] NeonCodex Agent: test cron schedule Reached the maximum number of tool rounds without the agent explicitly finishing. --- panel/__pycache__/__init__.cpython-312.pyc | Bin 139 -> 134 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 146 -> 141 bytes tests/__init__.py | 0 tests/test_cron.py | 549 ++++++++++++++++++ 4 files changed, 549 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/test_cron.py diff --git a/panel/__pycache__/__init__.cpython-312.pyc b/panel/__pycache__/__init__.cpython-312.pyc index 740ee817a783b314dc22e684b65f2ddcdad568cd..4e34c2f77f48d4d9b49c5ce993ccc2f3bd3c16b0 100644 GIT binary patch delta 43 xcmeBXY-8j;&CAQh00h7OE||z|ETXDko?nz*T#%TYs$Y^?TvDvBr#CU&1OOP?4YU9N delta 48 zcmZo;>}KRX&CAQh00bf2mJ_*+CAIW3@^e%5lXDVFQ&RQA@{3ARD*_VpQgbE-nE(JC C#trKL diff --git a/panel/routes/__pycache__/__init__.cpython-312.pyc b/panel/routes/__pycache__/__init__.cpython-312.pyc index 7ca3935043424f7f684ecb05930ac50112ff278f..36bc5309dd2ff63c42aa59292e08be4d199cd38f 100644 GIT binary patch delta 43 xcmbQl*vrU$nwOW00SJEmT`-Z`SVTv^JijQrxF9h(Rlg*)xTIKLPj6zlH2@pV4bT7p delta 48 zcmeBWoW#g|nwOW00SH34EhlmtOB(8D 0 + assert len(data['templates']) > 0 + + +class TestUnauthenticated: + """Every endpoint must return 401 when there is no session.""" + + @pytest.fixture() + def anon_client(self, tmp_path, monkeypatch): + from flask import Flask + app = Flask(__name__) + app.secret_key = 'test-secret' + app.config['TESTING'] = True + monkeypatch.setattr(cron_mod, 'get_crontab', lambda: '') + monkeypatch.setattr(cron_mod, 'set_crontab', lambda c: True) + monkeypatch.setattr(cron_mod, 'load_meta', lambda: {}) + monkeypatch.setattr(cron_mod, 'save_meta', lambda m: None) + app.register_blueprint(cron_mod.cron_bp) + return app.test_client() + + def test_list_jobs_401(self, anon_client): + assert anon_client.get('/api/cron/jobs').status_code == 401 + + def test_add_job_401(self, anon_client): + resp = anon_client.post('/api/cron/jobs', data='{}', content_type='application/json') + assert resp.status_code == 401 + + def test_edit_job_401(self, anon_client): + resp = anon_client.put('/api/cron/jobs/abc', data='{}', content_type='application/json') + assert resp.status_code == 401 + + def test_delete_job_401(self, anon_client): + assert anon_client.delete('/api/cron/jobs/abc').status_code == 401 + + def test_toggle_job_401(self, anon_client): + resp = anon_client.post('/api/cron/jobs/abc/toggle', data='{}', content_type='application/json') + assert resp.status_code == 401 + + def test_run_now_401(self, anon_client): + resp = anon_client.post('/api/cron/jobs/abc/run', data='{}', content_type='application/json') + assert resp.status_code == 401 + + def test_run_status_401(self, anon_client): + assert anon_client.get('/api/cron/run/abc').status_code == 401 + + def test_job_logs_401(self, anon_client): + assert anon_client.get('/api/cron/jobs/abc/logs').status_code == 401 + + def test_presets_401(self, anon_client): + assert anon_client.get('/api/cron/presets').status_code == 401