Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add test case to call setHTML on a new pad, based on

Pita/etherpad-lite#204
Extract common code to setUp method
Add some documentation
  • Loading branch information...
commit bd678bfd076ca04243b98e9e7ce06cde986c0933 1 parent 562a940
@timtebeek timtebeek authored
Showing with 21 additions and 4 deletions.
  1. +21 −4 src/test/test_py_etherpad.py
View
25 src/test/test_py_etherpad.py
@@ -1,19 +1,36 @@
+#!/usr/bin/env python
+"""Module to test py_etherpad."""
+
import py_etherpad
import unittest
class TestEtherpadLiteClient(unittest.TestCase):
+ """Class to test EtherpadLiteClient."""
+
+ def setUp(self):
+ """Assign a shared EtherpadLiteClient instance to self."""
+ self.ep_client = py_etherpad.EtherpadLiteClient()
def testCreateLargePad(self):
+ """Initialize a pad with a large body of text, and remove the pad if that succeeds."""
with open('tell-tale.txt') as read_handle:
content = read_handle.read()
- #Create client
- ep_client = py_etherpad.EtherpadLiteClient()
+ #Create and remove pad
+ print self.ep_client.createPad('telltale', content)
+ print self.ep_client.deletePad('telltale')
+
+ def testCreateHTMLPad(self):
+ """Create an initially empty pad, add a HTML text body and remove the pad if that succeeds."""
+ content = "<div><u>Underlined text</u><ul><li>this</li><li>is a</li><li><strong>unordered</strong></li>" + \
+ "<li>list</li></ul>after the list a newline is automatically <u>added</u>" + \
+ "<br>BR can also be used to force new <em>lines</em><p><strong>Or you can use paragraphs</strong></p></div>"
#Create and remove pad
- print ep_client.createPad('telltale', content)
- print ep_client.deletePad('telltale')
+ print self.ep_client.createPad('htmlpad')
+ print self.ep_client.setHTML('htmlpad', content)
+ print self.ep_client.deletePad('htmlpad')
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.testCreateLargePad']
Please sign in to comment.
Something went wrong with that request. Please try again.