mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 19:19:54 +00:00
fixed presence['type'] w/ show value bug and added test to prove
This commit is contained in:
parent
65dd83d4e1
commit
3dbd496de8
2 changed files with 14 additions and 12 deletions
|
@ -15,18 +15,18 @@ class Presence(RootStanza):
|
||||||
return self.xml.find("{%s}show" % self.namespace)
|
return self.xml.find("{%s}show" % self.namespace)
|
||||||
|
|
||||||
def setType(self, value):
|
def setType(self, value):
|
||||||
|
show = self.getShowElement()
|
||||||
if value in self.types:
|
if value in self.types:
|
||||||
show = self.getShowElement()
|
if show is not None:
|
||||||
if value in self.types:
|
self.xml.remove(show)
|
||||||
if show is not None:
|
if value == 'available':
|
||||||
self.xml.remove(show)
|
value = ''
|
||||||
if value == 'available':
|
self._setAttr('type', value)
|
||||||
value = ''
|
elif value in self.showtypes:
|
||||||
self._setAttr('type', value)
|
if show is None:
|
||||||
elif value in self.showtypes:
|
show = ET.Element("{%s}show" % self.namespace)
|
||||||
if show is None:
|
self.xml.append(show)
|
||||||
show = ET.Element("{%s}show" % self.namespace)
|
show.text = value
|
||||||
show.text = value
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def setPriority(self, value):
|
def setPriority(self, value):
|
||||||
|
|
|
@ -16,6 +16,7 @@ class testoverall(unittest.TestCase):
|
||||||
"""Invoking the tabnanny"""
|
"""Invoking the tabnanny"""
|
||||||
import tabnanny
|
import tabnanny
|
||||||
self.failIf(tabnanny.check("." + os.sep + 'sleekxmpp'))
|
self.failIf(tabnanny.check("." + os.sep + 'sleekxmpp'))
|
||||||
|
#raise "Help!"
|
||||||
|
|
||||||
def testMethodLength(self):
|
def testMethodLength(self):
|
||||||
"""Testing for excessive method lengths"""
|
"""Testing for excessive method lengths"""
|
||||||
|
@ -62,4 +63,5 @@ if __name__ == '__main__':
|
||||||
#sys.modules[modname].config = moduleconfig
|
#sys.modules[modname].config = moduleconfig
|
||||||
alltests.append(sys.modules[modname].suite)
|
alltests.append(sys.modules[modname].suite)
|
||||||
alltests_suite = unittest.TestSuite(alltests)
|
alltests_suite = unittest.TestSuite(alltests)
|
||||||
unittest.TextTestRunner(verbosity=2).run(alltests_suite)
|
result = unittest.TextTestRunner(verbosity=2).run(alltests_suite)
|
||||||
|
print("""<tests xmlns='http://andyet.net/protocol/tests' ran='%s' errors='%s' fails='%s' success='%s' />""" % (result.testsRun, len(result.errors), len(result.failures), result.wasSuccessful()))
|
||||||
|
|
Loading…
Reference in a new issue