'Make sure we can retrive a user\'s active (in progress) verification
attempt.'

def test_active_for_user(self):

    user = UserFactory.create()
    assert_is_none(SoftwareSecurePhotoVerification.active_for_user(user))
    attempt = SoftwareSecurePhotoVerification(user=user)
    attempt.mark_ready()
    assert_equals(attempt, SoftwareSecurePhotoVerification.active_for_user(user))
    user2 = UserFactory.create()
    user2.save()
    assert_is_none(SoftwareSecurePhotoVerification.active_for_user(user2))
    for status in ['submitted', 'must_retry', 'approved', 'denied']:
        attempt.status = status
        attempt.save()
        assert_is_none(SoftwareSecurePhotoVerification.active_for_user(user))
    attempt_2 = SoftwareSecurePhotoVerification(user=user)
    attempt_2.mark_ready()
    assert_equals(attempt_2, SoftwareSecurePhotoVerification.active_for_user(user))
    attempt_3 = SoftwareSecurePhotoVerification(user=user, created_at=(attempt_2.created_at + timedelta(days=1)))
    attempt_3.save()
    assert_equals(attempt_2, SoftwareSecurePhotoVerification.active_for_user(user))
    attempt_3.mark_ready()
    assert_equals(attempt_3, SoftwareSecurePhotoVerification.active_for_user(user))
