'Restores the AUTH_PROFILE_MODULE -- if it was not set it is deleted,
otherwise the old value is restored'

def tearDown(self):

    if ((self.old_AUTH_PROFILE_MODULE is None) and hasattr(settings, 'AUTH_PROFILE_MODULE')):
        del settings.AUTH_PROFILE_MODULE
    if (self.old_AUTH_PROFILE_MODULE is not None):
        settings.AUTH_PROFILE_MODULE = self.old_AUTH_PROFILE_MODULE
