void TestPackets::testBindNoResource() { const QByteArray xml( "<iq id=\"bind_1\" type=\"set\">" "<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\"/>" "</iq>"); QXmppBindIq bind; parsePacket(bind, xml); QCOMPARE(bind.type(), QXmppIq::Set); QCOMPARE(bind.id(), QString("bind_1")); QCOMPARE(bind.jid(), QString()); QCOMPARE(bind.resource(), QString()); serializePacket(bind, xml); }
void TestPackets::testBindResult() { const QByteArray xml( "<iq id=\"bind_2\" type=\"result\">" "<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\">" "<jid>[email protected]/someresource</jid>" "</bind>" "</iq>"); QXmppBindIq bind; parsePacket(bind, xml); QCOMPARE(bind.type(), QXmppIq::Result); QCOMPARE(bind.id(), QString("bind_2")); QCOMPARE(bind.jid(), QString("[email protected]/someresource")); QCOMPARE(bind.resource(), QString()); serializePacket(bind, xml); }
void tst_QXmppBindIq::testResource() { const QByteArray xml( "<iq id=\"bind_2\" type=\"set\">" "<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\">" "<resource>someresource</resource>" "</bind>" "</iq>"); QXmppBindIq bind; parsePacket(bind, xml); QCOMPARE(bind.type(), QXmppIq::Set); QCOMPARE(bind.id(), QString("bind_2")); QCOMPARE(bind.jid(), QString()); QCOMPARE(bind.resource(), QString("someresource")); serializePacket(bind, xml); }