|
Last change
on this file was
1,
checked in by myroslav, 21 years ago
|
|
Building directory structure
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | from Testing import ZopeTestCase |
|---|
| 2 | #from Products.Archetypes.tests import ArchetypesTestCase |
|---|
| 3 | from Products.CMFPlone.tests import PloneTestCase |
|---|
| 4 | from Products.CMFCore.utils import getToolByName |
|---|
| 5 | |
|---|
| 6 | from Products.PloneSMSCommunicator.pyXIAM import SMSsubmitRequest, getAllTextFromTag |
|---|
| 7 | import xml.dom |
|---|
| 8 | from xml.dom.minidom import * |
|---|
| 9 | |
|---|
| 10 | ZopeTestCase.installProduct('PloneSMSCommunicator') |
|---|
| 11 | |
|---|
| 12 | tests=[] |
|---|
| 13 | |
|---|
| 14 | class 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 | |
|---|
| 33 | tests.append(TestpyXIAM) |
|---|
| 34 | |
|---|
| 35 | def test_suite(): |
|---|
| 36 | from unittest import TestSuite, makeSuite |
|---|
| 37 | suite = TestSuite() |
|---|
| 38 | suite.addTest(makeSuite(TestpyXIAM)) |
|---|
| 39 | return suite |
|---|
| 40 | |
|---|
| 41 | if __name__ == '__main__': |
|---|
| 42 | framework() |
|---|
Note: See
TracBrowser
for help on using the repository browser.