Developing for anonymous assignments¶
Ensuring that anonymous assignments does not bleed any information about data that should be anonymous is fairly straight forward:
- Use the
*_displaynametags in The devilry_core_tags template library.
- If the template tags are not enough, use
devilry.apps.core.models.Assignment.examiners_must_be_anonymized_for_devilryrole()to determine what needs to be anonymized for the assignment.
- Read the plain text explaination of the choices for the anonymizationmode field.
You find this in the
devilry.apps.core.models.Assignment(in the source code).
- Read https://github.com/devilry/devilry-django/issues/846 for extra restrictions
fully_anonymousassignments in the admin UI.
The most important thing is to have tests that:
Adds users with shortname and fullname (examiners and candidates) to an anonymous assignment.
assertNotInto ensure names that should not be visible anywhere in the HTML is not present in the HTML. E.g.:
self.assertNotIn('shortnameofuser', mockresponse.response.content) self.assertNotIn('Full Name Of User', mockresponse.response.content)
Write tests like these for all of the 3 legal values for
You should, of course, also do some more structure sanity tests that checks that things are rendered
with the correct CSS class, but you do not need to rewrite the tests for the tags in
as long as your tests check that things that should be anonymized get one css class, and other things
get other css classes. The important css classes are:
devilry-user-verbose-inline: This is used for users when they are not anonymized.
devilry-core-candidate-anonymous-name: This is used for anonymized Candidates.
devilry-core-examiner-anonymous-name: This is used for anonymized Examiners.