tests.py
4.69 KB
-
Remove unused test · b61869f7
Now that the Jabber settings functionality is refactored into its own Django app, we don't need this test in the Courseware Django app. Rename get_password_for_user to get_or_create_... The new name describes more accurately what the function does: it creates a new password for the user if it can't find one in the database. Move DEFAULT_PASSWORD_LENGTH to JabberUser model This seems more appropriate as a property of the model as opposed to a loose constant in the utils module. Random string generation returns proper length Before, the length was only accurate if it was a multiple of four. Now, we calculate the number of bytes needed from /dev/urandom properly and we truncate the string to just the right length. (Base64 returns strings that are a multiple of four in length, but we truncate since we won't ever care to decode the string.) Adding working utility tests for Jabber app The majority of the functionality of the Jabber app is in the utils module, so we test those functions thoroughly. The test settings don't currently have settings to connect to a Jabber database (need @jrbl's help to get the migration files to set it up properly), so we temporarily skip tests that hit the Jabber users table. Add migration for Jabber users table for testing In testing environments, we want to be able to interact with the database as we create JabberUser instances. This commit adds a migration for the purposes of testing; the migration should *not* be used for anything else though. The actual Jabber users table should be created by ejabberd during provisioning. Unskip Jabber tests that interact with database Now that we have a migration for the Jabber users table in the test environment, we can hook it up in test and "unskip" the tests that hit that table.
Nate Hardison committed