diff options
author | bodqhrohro <bodqhrohro@gmail.com> | 2019-11-25 01:20:07 +0300 |
---|---|---|
committer | bodqhrohro <bodqhrohro@gmail.com> | 2019-11-25 01:20:07 +0300 |
commit | d6f6207ebb3d5256256a7810a3d3d0bdc8ba04a5 (patch) | |
tree | d52c3e2f4c7b4a46505b882782d850d28988ca11 /xmpp/component_test.go | |
parent | 653b1bde94b89d91862007a18b8730ff58673f59 (diff) |
Refactoring: move SendPresence to xmpp/gateway package
Diffstat (limited to 'xmpp/component_test.go')
-rw-r--r-- | xmpp/component_test.go | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/xmpp/component_test.go b/xmpp/component_test.go deleted file mode 100644 index b540ad4..0000000 --- a/xmpp/component_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package xmpp - -import ( - "encoding/xml" - "testing" - - "gosrc.io/xmpp/stanza" -) - -func testPresence(t *testing.T, presence stanza.Presence, reference string) { - byteXML, err := xml.Marshal(presence) - if err != nil { - t.Errorf("XML parse error: %v", err) - } - xmlText := string(byteXML) - if xmlText != reference { - t.Errorf("%v does not match %v", xmlText, reference) - } -} - -func TestPresenceFrom(t *testing.T) { - presence := newPresence("from@test", "to@test", SPFrom("test")) - testPresence(t, presence, "<presence from=\"test@from@test\" to=\"to@test\"></presence>") -} - -func TestPresenceNoFrom(t *testing.T) { - presence := newPresence("from@test", "to@test") - testPresence(t, presence, "<presence from=\"from@test\" to=\"to@test\"></presence>") -} - -func TestPresenceType(t *testing.T) { - presence := newPresence("from@test", "to@test", SPType("subscribe")) - testPresence(t, presence, "<presence type=\"subscribe\" from=\"from@test\" to=\"to@test\"></presence>") -} - -func TestPresenceShow(t *testing.T) { - presence := newPresence("from@test", "to@test", SPShow("dnd")) - testPresence(t, presence, "<presence from=\"from@test\" to=\"to@test\"><show>dnd</show></presence>") -} - -func TestPresenceStatus(t *testing.T) { - presence := newPresence("from@test", "to@test", SPStatus("cooking")) - testPresence(t, presence, "<presence from=\"from@test\" to=\"to@test\"><status>cooking</status></presence>") -} - -func TestPresenceNickname(t *testing.T) { - presence := newPresence("from@test", "to@test", SPNickname("Ishmael")) - testPresence(t, presence, "<presence from=\"from@test\" to=\"to@test\"><nick xmlns=\"http://jabber.org/protocol/nick\">Ishmael</nick></presence>") -} - -func TestPresencePhoto(t *testing.T) { - presence := newPresence("from@test", "to@test", SPPhoto("01b87fcd030b72895ff8e88db57ec525450f000d")) - testPresence(t, presence, "<presence from=\"from@test\" to=\"to@test\"><x xmlns=\"vcard-temp:x:update\"><photo>01b87fcd030b72895ff8e88db57ec525450f000d</photo></x></presence>") -} |