Example #1
0
    def test_set_my_name(self):
        yield self.handler.set_displayname(self.frank,
                                           requester_for_user(self.frank),
                                           "Frank Jr.")

        self.assertEquals(
            (yield self.store.get_profile_displayname(self.frank.localpart)),
            "Frank Jr.")
Example #2
0
    def test_set_my_avatar(self):
        yield self.handler.set_avatar_url(self.frank,
                                          requester_for_user(self.frank),
                                          "http://my.server/pic.gif")

        self.assertEquals(
            (yield self.store.get_profile_avatar_url(self.frank.localpart)),
            "http://my.server/pic.gif")
Example #3
0
    def test_set_my_name_noauth(self):
        d = self.handler.set_displayname(
            self.frank,
            requester_for_user(self.bob),
            "Frank Jr."
        )

        yield self.assertFailure(d, AuthError)
Example #4
0
    def test_set_my_avatar(self):
        yield self.handler.set_avatar_url(
            self.frank, requester_for_user(self.frank), "http://my.server/pic.gif"
        )

        self.assertEquals(
            (yield self.store.get_profile_avatar_url(self.frank.localpart)),
            "http://my.server/pic.gif"
        )
Example #5
0
    def test_set_my_name(self):
        yield self.handler.set_displayname(
            self.frank,
            requester_for_user(self.frank),
            "Frank Jr."
        )

        self.assertEquals(
            (yield self.store.get_profile_displayname(self.frank.localpart)),
            "Frank Jr."
        )
Example #6
0
 def send_text_message(self, room_id, message):
     handler = self.hs.get_handlers().message_handler
     event = yield handler.create_and_send_nonmember_event(
         requester_for_user(self.user),
         {
             "type": "m.room.message",
             "content": {"body": "message", "msgtype": "m.text"},
             "room_id": room_id,
             "sender": self.user.to_string(),
         },
     )
     defer.returnValue(event.event_id)
Example #7
0
 def send_text_message(self, room_id, message):
     handler = self.hs.get_handlers().message_handler
     event = yield handler.create_and_send_nonmember_event(
         requester_for_user(self.user), {
             "type": "m.room.message",
             "content": {
                 "body": "message",
                 "msgtype": "m.text"
             },
             "room_id": room_id,
             "sender": self.user.to_string(),
         })
     defer.returnValue(event.event_id)
Example #8
0
    def test_set_my_name_noauth(self):
        d = self.handler.set_displayname(self.frank,
                                         requester_for_user(self.bob),
                                         "Frank Jr.")

        yield self.assertFailure(d, AuthError)