def test_delete(self): l1 = len(listdir(self.tmpfolder)) p = [("id", "utf8test")] t = AppTester(self.admin, p, url="http://example.com/s/delete") r = t.run_get() self.assertEquals(len(listdir(self.tmpfolder)), l1-1) validate.validate_admin(XML(r.body))
def test_delete(self): l1 = len(listdir(self.tmpfolder)) p = [("id", "utf8test")] t = AppTester(self.admin, p, url="http://example.com/s/delete") r = t.run_get() self.assertEquals(len(listdir(self.tmpfolder)), l1 - 1) validate.validate_admin(XML(r.body))
def testIt(self): a = Admin("test.xsl") a.add(u"test", AdminTestApp, u"Test app") a.add(u"test2", AdminTestApp, u"Test app 2") a.compile() t = AppTester(a, [], "http://example.com/test/create") r = t.run_get(True) validate_admin(XML(r.body))
def test_save(self): p = [("e_id", "hello_world"), ("e_heading", "Hello World"), ("e_summary", "This is a test"), ("e_tags", "testtag, infotag"), ("e_post", "<p>Welcome to the test post</p>")] t = AppTester(self.admin, p, url="http://example.com/s/save") r = t.run_get() validate.validate_admin(XML(r.body)) path = join(self.tmpfolder, "hello_world") self.assert_(isfile(path)) post = open(path, "rb").read() self.assert_(post.count("testtag", 1)) self.assert_(post.count("infotag", 1))
def test_save(self): p = [ ("e_id", "hello_world"), ("e_heading", "Hello World"), ("e_summary", "This is a test"), ("e_tags", "testtag, infotag"), ("e_post", "<p>Welcome to the test post</p>") ] t = AppTester(self.admin, p, url="http://example.com/s/save") r = t.run_get() validate.validate_admin(XML(r.body)) path = join(self.tmpfolder, "hello_world") self.assert_(isfile(path)) post = open(path, "rb").read() self.assert_(post.count("testtag", 1)) self.assert_(post.count("infotag", 1))
def test_save_error(self): t = AppTester(self.admin, [], url="http://example.com/s/save") r = t.run_get() validate.validate_admin(XML(r.body))
def test_edit(self): p = [("id", "utf8test")] t = AppTester(self.admin, p, url="http://example.com/s/edit") r = t.run_get() validate.validate_admin(XML(r.body))
def test_create(self): t = AppTester(self.admin, url="http://example.com/s/create") r = t.run_get() validate.validate_admin(XML(r.body))
def test_validate_admin(self): validate_admin(XML(ADMIN))