示例#1
0
 def test_call_events(self):
     for event_type, event_file in [
         (CallInviteEvent, "call_invite.json"),
         (CallAnswerEvent, "call_answer.json"),
         (CallCandidatesEvent, "call_candidates.json"),
         (CallHangupEvent, "call_hangup.json"),
     ]:
         parsed_dict = TestClass._load_response(
             "tests/data/events/{}".format(event_file))
         event = CallEvent.parse_event(parsed_dict)
         assert isinstance(event, event_type)
示例#2
0
 def test_invalid_call_events(self):
     for _, event_file in [
         (CallInviteEvent, "call_invite.json"),
         (CallAnswerEvent, "call_answer.json"),
         (CallCandidatesEvent, "call_candidates.json"),
         (CallHangupEvent, "call_hangup.json"),
     ]:
         parsed_dict = TestClass._load_response(
             "tests/data/events/{}".format(event_file))
         parsed_dict["content"].pop("call_id")
         event = CallEvent.parse_event(parsed_dict)
         assert isinstance(event, BadEvent)