Annotate

tests/test_util_stanza.lua @ 5915:e6fed1d80116

Back out 1b0ac7950129, as SSLv3 appears to still be in moderate use on the network. Also, although obsolete, SSLv3 isn't documented to have any weaknesses that TLS 1.0 (the most common version used today) doesn't also have. Get your act together clients!
author Matthew Wild <mwild1@gmail.com>
date Tue, 12 Nov 2013 02:13:01 +0000
parent 3639:889ef938552c
child 5776:bd0ff8ae98a8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1522
569d58d21612 Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents: 682
diff changeset
1 -- Prosody IM
2923
b7049746bd29 Update copyright headers for 2010
Matthew Wild <mwild1@gmail.com>
parents: 1522
diff changeset
2 -- Copyright (C) 2008-2010 Matthew Wild
b7049746bd29 Update copyright headers for 2010
Matthew Wild <mwild1@gmail.com>
parents: 1522
diff changeset
3 -- Copyright (C) 2008-2010 Waqas Hussain
1522
569d58d21612 Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents: 682
diff changeset
4 --
569d58d21612 Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents: 682
diff changeset
5 -- This project is MIT/X11 licensed. Please see the
569d58d21612 Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents: 682
diff changeset
6 -- COPYING file in the source package for more information.
569d58d21612 Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents: 682
diff changeset
7 --
569d58d21612 Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents: 682
diff changeset
8
682
dedd19e9d4b3 Add more tests for util/stanza.lua serialization routines
Matthew Wild <mwild1@gmail.com>
parents: 681
diff changeset
9
dedd19e9d4b3 Add more tests for util/stanza.lua serialization routines
Matthew Wild <mwild1@gmail.com>
parents: 681
diff changeset
10 function preserialize(preserialize, st)
dedd19e9d4b3 Add more tests for util/stanza.lua serialization routines
Matthew Wild <mwild1@gmail.com>
parents: 681
diff changeset
11 local stanza = st.stanza("message", { a = "a" });
dedd19e9d4b3 Add more tests for util/stanza.lua serialization routines
Matthew Wild <mwild1@gmail.com>
parents: 681
diff changeset
12 local stanza2 = preserialize(stanza);
dedd19e9d4b3 Add more tests for util/stanza.lua serialization routines
Matthew Wild <mwild1@gmail.com>
parents: 681
diff changeset
13 assert_is(stanza2 and stanza.name, "preserialize returns a stanza");
dedd19e9d4b3 Add more tests for util/stanza.lua serialization routines
Matthew Wild <mwild1@gmail.com>
parents: 681
diff changeset
14 assert_is_not(stanza2.tags, "Preserialized stanza has no tag list");
dedd19e9d4b3 Add more tests for util/stanza.lua serialization routines
Matthew Wild <mwild1@gmail.com>
parents: 681
diff changeset
15 assert_is_not(stanza2.last_add, "Preserialized stanza has no last_add marker");
dedd19e9d4b3 Add more tests for util/stanza.lua serialization routines
Matthew Wild <mwild1@gmail.com>
parents: 681
diff changeset
16 assert_is_not(getmetatable(stanza2), "Preserialized stanza has no metatable");
dedd19e9d4b3 Add more tests for util/stanza.lua serialization routines
Matthew Wild <mwild1@gmail.com>
parents: 681
diff changeset
17 end
681
686b73503ce8 Add test for previous commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
18
686b73503ce8 Add test for previous commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
19 function deserialize(deserialize, st)
686b73503ce8 Add test for previous commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
20 local stanza = st.stanza("message", { a = "a" });
686b73503ce8 Add test for previous commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
21
686b73503ce8 Add test for previous commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
22 local stanza2 = deserialize(st.preserialize(stanza));
682
dedd19e9d4b3 Add more tests for util/stanza.lua serialization routines
Matthew Wild <mwild1@gmail.com>
parents: 681
diff changeset
23 assert_is(stanza2 and stanza.name, "deserialize returns a stanza");
dedd19e9d4b3 Add more tests for util/stanza.lua serialization routines
Matthew Wild <mwild1@gmail.com>
parents: 681
diff changeset
24 assert_table(stanza2.attr, "Deserialized stanza has attributes");
dedd19e9d4b3 Add more tests for util/stanza.lua serialization routines
Matthew Wild <mwild1@gmail.com>
parents: 681
diff changeset
25 assert_equal(stanza2.attr.a, "a", "Deserialized stanza retains attributes");
dedd19e9d4b3 Add more tests for util/stanza.lua serialization routines
Matthew Wild <mwild1@gmail.com>
parents: 681
diff changeset
26 assert_table(getmetatable(stanza2), "Deserialized stanza has metatable");
681
686b73503ce8 Add test for previous commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
27 end