def test_deactivate_inactive_institution_noop(self): institution = InstitutionFactory() institution.deactivated = timezone.now() institution.save() with mock.patch.object(institution, 'save', return_value=None) as mock_save: institution.deactivate() assert not mock_save.called
def test_deactivate_institution(self): institution = InstitutionFactory() with mock.patch.object( institution, '_send_deactivation_email', return_value=None) as mock__send_deactivation_email: institution.deactivate() assert institution.deactivated is not None assert mock__send_deactivation_email.called