def test_nickConflict(self):

        def cb(failure, room):
            user = room.getUser(otherNick)
            self.assertNotIdentical(None, user)
            self.assertEqual(otherJID, user.entity)

        def joined(room):
            d = self.protocol.nick(room.roomJID, otherNick)
            self.assertFailure(d, StanzaError)
            d.addCallback(cb, room)

        otherJID = JID('other@example.org/Home')
        otherNick = 'otherNick'

        d = self.protocol.join(self.roomJID, self.nick)
        d.addCallback(joined)

        # Send back other partipant's presence.
        xml = u"""
            <presence from='%s/%s'>
              <x xmlns='http://jabber.org/protocol/muc#user'>
                <item affiliation='member' role='participant' jid='%s'/>
              </x>
            </presence>
        """ % (self.roomJID, otherNick, otherJID)
        self.stub.send(parseXml(xml))

        # send back user presence, they joined
        xml = u"""
            <presence from='%s/%s'>
              <x xmlns='http://jabber.org/protocol/muc#user'>
                <item affiliation='member' role='participant'/>
              </x>
            </presence>
        """ % (self.roomJID, self.nick)
        self.stub.send(parseXml(xml))

        # send back error presence, nick conflicted
        xml = u"""
            <presence from='%s/%s' type='error'>
                <x xmlns='http://jabber.org/protocol/muc'/>
                <error type='cancel'>
                  <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
                </error>
            </presence>
        """ % (self.roomJID, otherNick)
        self.stub.send(parseXml(xml))
        return d
If the server finds the new nick in conflict, the errback is called.
dataset/ETHPy150Open ralphm/wokkel/wokkel/test/test_muc.py/MUCClientTest.test_nickConflict