1
0
Files
coldcall_lti/tests/test_cli.py
Benjamin Mako Hill 7ec1be5dc6 Phase 5: reporting, exports, pronouns, and roster freshness
Instructor participation report: per-student histograms, outcome mix
by class day, and a sortable table including the fairness ratio
(answered calls over questions present for, with opt-out days out of
the denominator), plus CSV exports of students, calls, and opt-outs.

Assessment scales are now per-course data: ordered levels with labels
and points out of 100 (defaults carry the old R grading values), with
calls referencing levels by id so renames follow through to history.
Renaming, re-pointing, reordering, and adding levels are always
allowed; deleting a level in use by recorded calls is blocked.

Pronouns and course term dates come from Canvas custom variable
substitutions, at launch and roster-wide via rlid-scoped NRPS; the
student page notes that names/pronouns are Canvas-sourced. Rosters
can also be refreshed outside launches: a "Sync roster now" button
and a sync-rosters CLI command for an hourly cron job, skipping ended
courses. Alembic now runs SQLite-compatible batch migrations with a
constraint naming convention.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-31 17:05:34 -07:00

31 lines
996 B
Python

import datetime
from sqlalchemy import select
from coldcall_lti.models import Course
from conftest import make_app
def test_sync_rosters_skips_unsyncable_and_ended_courses(tmp_path):
app = make_app(tmp_path, dev_mode=True)
client = app.test_client()
client.post("/dev/launch/dev-instructor") # creates the dev course
with app.app_context():
db = app.extensions["db_session_factory"]()
ended = Course(
lti_context_id="old-course",
title="Old Course",
nrps_url="https://example.edu/nrps",
end_date=datetime.date.today() - datetime.timedelta(days=90),
)
db.add(ended)
db.commit()
db.close()
result = app.test_cli_runner().invoke(args=["sync-rosters"])
assert result.exit_code == 0
# The dev course has no NRPS service; the old course has ended.
assert "no roster service recorded, skipped" in result.output
assert "Old Course: ended, skipped" in result.output