Exemple #1
0
    def test_invalid_invite_state_events(self):
        for event_type, event_file in [
            ("m.room.member", "member.json"),
            ("m.room.canonical_alias", "alias.json"),
            ("m.room.name", "name.json"),
        ]:
            parsed_dict = TestClass._load_response(
                "tests/data/events/{}".format(event_file)
            )
            parsed_dict.pop("state_key")

            event = InviteEvent.parse_event(parsed_dict)

            assert isinstance(event, BadEvent)
            assert event.source["type"] == event_type

        for event_type, event_file in [
            ("m.room.member", "member.json"),
            ("m.room.canonical_alias", "alias.json"),
            ("m.room.name", "name.json"),
        ]:
            parsed_dict = TestClass._load_response(
                "tests/data/events/{}".format(event_file)
            )
            parsed_dict.pop("type")

            event = InviteEvent.parse_event(parsed_dict)
            assert not event
Exemple #2
0
 def test_invite_events(self):
     for event_type, event_file in [
         (InviteMemberEvent, "member.json"),
         (InviteAliasEvent, "alias.json"),
         (InviteNameEvent, "name.json"),
     ]:
         parsed_dict = TestClass._load_response(
             "tests/data/events/{}".format(event_file))
         event = InviteEvent.parse_event(parsed_dict)
         assert isinstance(event, event_type)