source: products/PloneSMSCommunicator/trunk/tests/testpyXIAM.py @ 2284

Last change on this file since 2284 was 1, checked in by myroslav, 18 years ago

Building directory structure

File size: 1.2 KB
Line 
1from Testing import ZopeTestCase
2#from Products.Archetypes.tests import ArchetypesTestCase
3from Products.CMFPlone.tests import PloneTestCase
4from Products.CMFCore.utils import getToolByName
5
6from Products.PloneSMSCommunicator.pyXIAM import SMSsubmitRequest, getAllTextFromTag
7import xml.dom
8from xml.dom.minidom import *
9
10ZopeTestCase.installProduct('PloneSMSCommunicator')
11
12tests=[]
13
14class TestpyXIAM(PloneTestCase.PloneTestCase):
15
16    def afterSetUp(self):
17        portal = self.portal
18        sms=SMSsubmitRequest(originator = '+380979312198', destination = ['+380979987348'], body = 'hello how are you?')
19        self.doc = sms.toXML()
20        self.doc = parseString(self.doc)
21
22
23    def test_originator(self):
24        self.assertEqual(getAllTextFromTag(self.doc, 'from')[0], '+380979312198')
25
26    def test_destination(self):
27        self.assertEqual(getAllTextFromTag(self.doc, 'to')[0], '+380979987348')
28
29    def test_content(self):
30        self.assertEqual(getAllTextFromTag(self.doc, 'content')[0], 'hello how are you?')
31
32
33tests.append(TestpyXIAM)
34
35def test_suite():
36    from unittest import TestSuite, makeSuite
37    suite = TestSuite()
38    suite.addTest(makeSuite(TestpyXIAM))
39    return suite
40
41if __name__ == '__main__':
42    framework()
Note: See TracBrowser for help on using the repository browser.