Draft
Conversation
…e) with fixtures and tests Agent-Logs-Url: https://github.com/EdupageAPI/edupage-api/sessions/1fc8f639-eed6-483a-8126-1555e642ba88 Co-authored-by: ivanhrabcak <39710116+ivanhrabcak@users.noreply.github.com>
Agent-Logs-Url: https://github.com/EdupageAPI/edupage-api/sessions/1fc8f639-eed6-483a-8126-1555e642ba88 Co-authored-by: ivanhrabcak <39710116+ivanhrabcak@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
ivanhrabcak
April 11, 2026 23:33
View session
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Edupage has no REST API, so the library parses HTML/JS responses that can change without notice. There's currently no way to test parsing logic without live credentials and a real Edupage session.
New module:
edupage_api/testing.pyEduRecorder— context manager that wrapssession.sendto intercept a live session and serialise every HTTP exchange plusedupage.datato a JSON fixture file. Accepts an optionalanonymisercallback to scrub personal data before writing.MockSession—requests.Sessionsubclass that replays responses from a fixture keyed by(method, url). RaisesUnexpectedRequestErrorfor any unmapped request, keeping tests deterministic. Multiple responses for the same URL are consumed in order.EdupageTestCase—unittest.TestCasebase class with aget_edupage(fixture_path)factory that hydrates a freshEdupageinstance from a fixture and swaps inMockSession— no login flow, no network.Fixture format
{ "meta": { "subdomain": "myschool", "username": "student", "gsec_hash": "…" }, "data": { /* full userhome payload */ }, "requests": [ { "method": "GET", "url": "https://myschool.edupage.org/znamky/", "response": { "status_code": 200, "text": "…" } } ] }Multiple fixture variants per feature (
grades_school_a.json,grades_school_b.json) let you assert that parsers handle both old and new server response shapes simultaneously.Usage
Record once (requires a real account):
Replay in CI (no credentials):
Initial tests
Adds
tests/fixtures/notifications.json(synthetic, anonymised) andtests/test_notifications.py(19 tests) covering timeline item parsing,userPropsstate (starred/done), andMockSessionerror behaviour — all without network access.