summaryrefslogtreecommitdiff
path: root/tests/test_stanzabase.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-10-07 10:58:13 -0400
committerLance Stout <lancestout@gmail.com>2010-10-07 10:58:13 -0400
commit0fffbb82000a1a6c3c23d62fedcbd8e8141f8994 (patch)
tree114c3767ccc13de3d0388b43cd357b90334f469a /tests/test_stanzabase.py
parent21c32c6e1cfd9b18e4c8320e0796e1d7e4b3f74c (diff)
downloadslixmpp-0fffbb82000a1a6c3c23d62fedcbd8e8141f8994.tar.gz
slixmpp-0fffbb82000a1a6c3c23d62fedcbd8e8141f8994.tar.bz2
slixmpp-0fffbb82000a1a6c3c23d62fedcbd8e8141f8994.tar.xz
slixmpp-0fffbb82000a1a6c3c23d62fedcbd8e8141f8994.zip
Unit test reorganization.
Moved SleekTest to sleekxmpp.test. Organized test suites by their focus. - Suites focused on testing stanza objects are named test_stanza_X.py - Suites focused on testing stream behavior are name test_stream_X.py
Diffstat (limited to 'tests/test_stanzabase.py')
-rw-r--r--tests/test_stanzabase.py79
1 files changed, 0 insertions, 79 deletions
diff --git a/tests/test_stanzabase.py b/tests/test_stanzabase.py
deleted file mode 100644
index 682068d9..00000000
--- a/tests/test_stanzabase.py
+++ /dev/null
@@ -1,79 +0,0 @@
-from . sleektest import *
-import sleekxmpp
-from sleekxmpp.xmlstream.stanzabase import ET, StanzaBase
-
-class TestStanzaBase(SleekTest):
-
- def testTo(self):
- """Test the 'to' interface of StanzaBase."""
- stanza = StanzaBase()
- stanza['to'] = 'user@example.com'
- self.failUnless(str(stanza['to']) == 'user@example.com',
- "Setting and retrieving stanza 'to' attribute did not work.")
-
- def testFrom(self):
- """Test the 'from' interface of StanzaBase."""
- stanza = StanzaBase()
- stanza['from'] = 'user@example.com'
- self.failUnless(str(stanza['from']) == 'user@example.com',
- "Setting and retrieving stanza 'from' attribute did not work.")
-
- def testPayload(self):
- """Test the 'payload' interface of StanzaBase."""
- stanza = StanzaBase()
- self.failUnless(stanza['payload'] == [],
- "Empty stanza does not have an empty payload.")
-
- stanza['payload'] = ET.Element("{foo}foo")
- self.failUnless(len(stanza['payload']) == 1,
- "Stanza contents and payload do not match.")
-
- stanza['payload'] = ET.Element('{bar}bar')
- self.failUnless(len(stanza['payload']) == 2,
- "Stanza payload was not appended.")
-
- del stanza['payload']
- self.failUnless(stanza['payload'] == [],
- "Stanza payload not cleared after deletion.")
-
- stanza['payload'] = [ET.Element('{foo}foo'),
- ET.Element('{bar}bar')]
- self.failUnless(len(stanza['payload']) == 2,
- "Adding multiple elements to stanza's payload did not work.")
-
- def testClear(self):
- """Test clearing a stanza."""
- stanza = StanzaBase()
- stanza['to'] = 'user@example.com'
- stanza['payload'] = ET.Element("{foo}foo")
- stanza.clear()
-
- self.failUnless(stanza['payload'] == [],
- "Stanza payload was not cleared after calling .clear()")
- self.failUnless(str(stanza['to']) == "user@example.com",
- "Stanza attributes were not preserved after calling .clear()")
-
- def testReply(self):
- """Test creating a reply stanza."""
- stanza = StanzaBase()
- stanza['to'] = "recipient@example.com"
- stanza['from'] = "sender@example.com"
- stanza['payload'] = ET.Element("{foo}foo")
-
- stanza.reply()
-
- self.failUnless(str(stanza['to'] == "sender@example.com"),
- "Stanza reply did not change 'to' attribute.")
- self.failUnless(stanza['payload'] == [],
- "Stanza reply did not empty stanza payload.")
-
- def testError(self):
- """Test marking a stanza as an error."""
- stanza = StanzaBase()
- stanza['type'] = 'get'
- stanza.error()
- self.failUnless(stanza['type'] == 'error',
- "Stanza type is not 'error' after calling error()")
-
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestStanzaBase)