ucam-department-of-psychiatry / camcops

Cambridge Cognitive and Psychiatric Test Kit (CamCOPS)
Other
12 stars 8 forks source link

Generate random data in task tests #221

Closed RudolfCardinal closed 2 years ago

RudolfCardinal commented 2 years ago

(1) Make tests use the random data generation and ensure that they don't crash when rendering HTM. (2) Fix the expectation/detection threshold task so it passes that test with random data. (3) Fix bug where that recent style change in base_web.mako used request.matched_route.name when it might not exist (I think because request.matched_route was None but not absolutely sure) -- this caused a rendering crash to the log (though the PDF still got generated!). Not quite sure what base_web.mako is contributing to the PDF view, though.

martinburchell commented 2 years ago

Good idea!

I've removed the body class for now. It's there in version control if we ever want it back.

I mean to look at Factory Boy (https://factoryboy.readthedocs.io/) at some point for creating test fixtures. I've used it with Django and it claims to support SQLAlchemy.