def test_get_open_sms_session_multiple_results(self): domain = uuid.uuid4().hex contact = uuid.uuid4().hex for i in range(3): _make_session( domain=domain, connection_id=contact, end_time=None, session_type=XFORMS_SESSION_SMS, ) with self.assertRaises(MultipleResultsFound): SQLXFormsSession.get_open_sms_session(domain, contact)
def test_get_open_sms_session_one_result(self): domain = uuid.uuid4().hex contact = uuid.uuid4().hex new_session = _make_session( domain=domain, connection_id=contact, end_time=None, session_type=XFORMS_SESSION_SMS, ) session = SQLXFormsSession.get_open_sms_session(domain, contact) self.assertEqual(new_session.session_id, session.session_id)
def get_open_session(self, contact): return SQLXFormsSession.get_open_sms_session(self.domain, contact._id)
def test_get_open_sms_session_no_results(self): self.assertEqual( None, SQLXFormsSession.get_open_sms_session(uuid.uuid4().hex, uuid.uuid4().hex))
def test_get_open_sms_session_no_results(self): self.assertEqual(None, SQLXFormsSession.get_open_sms_session(uuid.uuid4().hex, uuid.uuid4().hex))