learning-unlimited/ESP-Website — pull request #1300 by jmoldow (2014-09-08 16:37:22+00:00)
Title: Disable south migrations during testing

Since testing begins from a fresh database, schema migrations are unnecessary to run at the beginning of testing. The Django standard ```syncdb``` should be sufficient. Our ```post_syncdb()``` handlers take care of installing anything that needs to exist in the database at all times, data migrations don't need to be performed on empty database tables, and fixture migrations aren't needed during testing, since tests use their own fake test data.

South migrations during testing are turned off in commit 9fcfdf8. Additionally, a number of changes were needed as prerequisites to getting this to work:
- b7a481d - Removes SR4 expire_unsent_emails migration check

Without this, ```dbmail``` tests fail because no mail is allowed to be sent. And this was supposed to be done after the complete rollout of stable release 04 anyway.
- 3c6b464 - Fix how JSONDataModule is added to created program

I still don't know why this bug was only discovered after turning off migrations. But whatever, it's fixed now.

- 3ef9b21 - Revert "Add trivial test of repeat syncdb and migrate commands"

```DBOpsTestCase``` was failing if ```migrate``` hadn't already been run. As I explain in this commit message, I think this test case is unnecessary.

- b3fc86a - Corrects typo in program post_syncdb()

This typo was preventing the ```program.class_.install()``` function from ever running.

- 954364f - Prevents IndexError by ensuring web.install() runs

Locally corrects a bug that was also more generally fixed with commit 82d8a67.

- 82d8a67 - Makes the post_syncdb() functions idempotent

In Django's ```test``` command, ```flush``` gets called after ```syncdb```, so the ```post_syncdb()``` handlers need to be idempotent, not run-once, in order to make sure the initial data gets installed correctly.

- 8abb4d7 - Ensures default accounts are installed

The default accounts need to be installed on ```post_syncdb```, not just during migrations.

- 5c51185 - Ensures customforms schema is created

The customforms schema needs to be installed on ```post_syncdb```, not just during migrations.

With these changes, tests can run successfully without migrating first. However, we don't have 100% code coverage in our tests, and I didn't manually check all of our migrations. So it's possible that there is some important migration that I missed whose functionality will eventually need to be moved into an ```install()``` function when we attain higher code coverage.

Additionally, there are some semi-related or not-at-all-related commits to do some cleanup:
- a2cf852 - Hide unnecessary debugging information
- 784e125 - Fixes bugs in LSRAssignmentTest
- 61d463d - Adds customforms classes to shell_utils
- 1fa5554 - Removes old classchange.py script
- 7d0ab6a - Code cleanup