Developing for anonymous assignments

Ensuring that anonymous assignments does not bleed any information about data that should be anonymous is fairly straight forward:

In tests

The most important thing is to have tests that:

  • Adds users with shortname and fullname (examiners and candidates) to an anonymous assignment.

  • Use assertNotIn to 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 devilry.apps.core.models.Assignment.anonymizationmode.

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 devilry_core_tags 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.