Changeset 218:71cba82a4b8b


Ignore:
Timestamp:
Oct 4, 2016, 9:02:20 AM (4 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
hg-git-rename-source:
git
Message:

Add tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/test/test_muc.py

    r185 r218  
    14911491
    14921492
     1493    def test_availableReceivedSetsUserRole(self):
     1494        """
     1495        The role received in a presence update is stored on the user.
     1496        """
     1497        room = self._createRoom()
     1498        user = muc.User(self.nick)
     1499        room.addUser(user)
     1500        self.assertEquals('none', user.role)
     1501
     1502        xml = u"""
     1503            <presence to='%s' from='%s'>
     1504              <x xmlns='http://jabber.org/protocol/muc#user'>
     1505                <item affiliation='member' role='participant'/>
     1506              </x>
     1507            </presence>
     1508        """ % (self.userJID, self.occupantJID)
     1509        self.stub.send(parseXml(xml))
     1510
     1511        self.assertEquals('participant', user.role)
     1512
     1513
     1514    def test_availableReceivedSetsUserAffiliation(self):
     1515        """
     1516        The affiliation received in a presence update is stored on the user.
     1517        """
     1518        room = self._createRoom()
     1519        user = muc.User(self.nick)
     1520        room.addUser(user)
     1521        self.assertEquals('none', user.affiliation)
     1522
     1523        xml = u"""
     1524            <presence to='%s' from='%s'>
     1525              <x xmlns='http://jabber.org/protocol/muc#user'>
     1526                <item affiliation='member' role='participant'/>
     1527              </x>
     1528            </presence>
     1529        """ % (self.userJID, self.occupantJID)
     1530        self.stub.send(parseXml(xml))
     1531        self.assertEquals('member', user.affiliation)
     1532
     1533
    14931534    def test_unavailableReceivedEmptySender(self):
    14941535        """
Note: See TracChangeset for help on using the changeset viewer.