Extract max item ages from loops.

There's no point re-creating these each time around, and they'll be
clearer to change now they're isolated.

Change-Id: I615a20d4fe58f2c731b0d1da3dcfc13c3b6498de
Reset LDAP before running the tests.

While it takes a little longer each run, the number of times I've
had to re-run the tests because of the initial state being invalid
means this will be better overall.

Change-Id: Ib8b3426a2b08ec8e4a64a38a9be3eac05434a5b2
Extract template loading to helper.

This makes it possible to load a template without actually having
to send an email.

Change-Id: I551a41ff3c62e37dcd091cbf2cbab6c77948fe37
Add template testing.

Previously, we only checked that each attempt to send email created
dictionaries with the 'right' keys. Now we also check those against
the actual templates to ensure that the whole system works.

Change-Id: Icd52f417698a6fd0f8fbc6e9d72e44b7baad0588
Also email the student once activated.

This confirms to them that they've activated their account, and
points them towards some of the more useful resources on the website.

Change-Id: I7be2f51ddc6a5f674b786f0bbac2afade4208b99
Extract activation and email change deadlines to config.

This makes it possible to change these values more easily since
they are now controlled by the configuration, rather than the code.

Change-Id: I43b024758e99a51da14f98c667b7de8f0c10e1e4
Also email competitors when they fail to activate accounts.

In addition to emailing the team leader, we now email the competitor
so that it's clear to them that they've failed to do something.

Change-Id: I8e0b8565ddcfa0112bc19af80a8173fab1f5707f
Cut back the information in the initial competitor email.

This reduces the first email that competitors receive to being a
minimal instruction that they need to activate their account. While
it still tells them why they'd want an account, and that there's
one waiting for them, it no longer tells them anything about the
accout itself.

Their email and username are no longer listed in the email (though
the username remains part of the activation url; most people probably
won't notice that).

The information that the link is only valid for a short time is
also now more prominent.

Change-Id: Ie4e775b7ebbba5c7e9f31cf2b407fb67272567ac
Increase how long competitors have to confirm things.

Bump the activation duration to 5 days and the email change to 3 days.
Since the latter is more likely to be a competitor-driven action,
they're more likely to deal with it sonner.

Change-Id: I82ccae9caf59196684b90f8f4082fc43a1710978
Bump libnemesis to also reset the media-consent group

During testing we need to be sure that the initial state of the LDAP
matches our expectations. If it isn't, we get false test failures.

Change-Id: I767bc4a9a8a816ad925f13d202bf97af328e4246
Remove redundant 'logging' import.

Change-Id: I3a061ba672b6d7b9c847a8f4f74632b9d8756c9b
Ensure exception traces make it to the syslog

It turns out that the SysLogHangler doesn't compensate for the log
messages potentially containing newlines (while newlines in the
actual message portion are escaped, the appneded traceback from
exceptions contains unescaped ones). While it does document this
behaviour it's neither obvious nor useful.

Escape newlines (etc.) in log messages by adding a formatter which
does this. Use this when logging via syslog.

Path set 2: clarify code by not overwriting the msg variable

Change-Id: Ia2b7db17c332bfbff814542f213f77aee4489965
Fix some incorrect wording

Looks to be a copy+paste error

Change-Id: I98f976133c8cf751e9373c31f1db2c8baf56019d
Ensure valid run-test exit code

Use | rather than + since the latter would cause 1 then -1 to falsely
report a successful run.

Change-Id: I772636330eef9b179660fcea43920ac26d302429