def test_is_expired(self):
    email = self.demo_user.primary_email
    new_action = EmailAuthAction(user=self.demo_user, action_code = VERIFY_EMAIL, email=email.address)
    new_action.expire_at = get_current_time_plus(hours=0)
    db.session.add(new_action)
    db.session.commit()
    self.assertTrue(new_action.isExpired())
 def test_create_ok(self):
    email = self.demo_user.primary_email
    new_action = EmailAuthAction(user=self.demo_user, action_code = VERIFY_EMAIL, email=email.address)
    db.session.add(new_action)
    db.session.commit()
    self.assertEqual(new_action.email_ref, email)
    self.assertFalse(new_action.isExpired())
    self.assertEqual(new_action.action, EMAIL_ACTION[new_action.action_code])
    self.assertEqual(new_action.action_code, VERIFY_EMAIL)
    self.assertEqual(new_action.email, email.address)