Exemplo n.º 1
0
 def getHtml(self, params={}):
     html = """
     <html>
     <head>
     {header}
     </head>
     <body id=\"{pageId}\">
     {body}
     </body>
     </html>
     """
     self.allParams = {}
     self.allParams.update(self.coreParams)
     self.allParams.update(params)
     Settings.updateParams(self.allParams)
     theHeader = self.getHtmlHeader()
     thePageId = self.pageId
     theBody = self.getHtmlBody()
     answer = Page.stripWhitespace(html.format(header=theHeader, pageId=thePageId, body=theBody))
     return answer
Exemplo n.º 2
0
#!/usr/bin/python
import sys
import os
from cgi import FieldStorage

root = os.getcwd() + "/../.."
sys.path.insert(0, root + "/python")

from pages.settings import Settings
Settings.setRootDirectory(root)

html = """
<html>
<body>
<p>{version}<p>
<p>{syspath}<p>
<p>{cwd}<p>
<p>{params}</p>
<p>{dataDir}</p>
</body>
</html>
""" 

parms = FieldStorage()
paramDict = {} 
for k in parms.keys():
    paramDict[k] = parms.getvalue(k)

print ("Content-Type: text/html\n")
print (html.format(version=sys.version, syspath=sys.path, cwd=os.getcwd(), params=paramDict, dataDir=Settings.dataDirectory))
Exemplo n.º 3
0
 def testGetNewsDefaultNews(self):
     Settings.setRootDirectory(".")
     result = HomePage("").getNews()
     self.assertTrue(result is not None)
     print(result)
Exemplo n.º 4
0
 def testGetNewsNonEmptyNewsDir(self):
     Settings.setRootDirectory("testData/news/notexpired")
     result = HomePage("").getNews()
     self.assertEquals(1, string.count(result, "<p>"))
Exemplo n.º 5
0
 def testGetNewsExpiredNewsDir(self):
     Settings.setRootDirectory("testData/news/expired")
     result = HomePage("").getNews()
     self.assertEquals("", result)
Exemplo n.º 6
0
 def testUpdateParamsSeasonSpecified(self):
     params = {"season": "10"}
     Settings.updateParams(params)
     Settings.setRootDirectory("/home/sehicl")
     self.assertEquals("/home/sehicl/data/2009-10.xml", params["xmlFile"])
Exemplo n.º 7
0
 def testUpdateParamsNoSeasonSpecified(self):
     params = {}
     Settings.defaultSeason = 8
     Settings.setRootDirectory("/home/sehicl")
     Settings.updateParams(params)
     self.assertEquals("/home/sehicl/data/2007-08.xml", params["xmlFile"])
Exemplo n.º 8
0
 def testSettingsLoad(self):
     Settings()
Exemplo n.º 9
0
 def click_settings_menu_item(self):
     self.click_options()
     self.selenium.find_element(
         *self._settings_menu_item_locator).click()
     from pages.settings import Settings
     return Settings(self.base_url, self.selenium)
Exemplo n.º 10
0
 def click_settings(self):
     self.selenium.find_element(*self._settings_locator).click()
     from pages.settings import Settings
     return Settings(self.testsetup)
Exemplo n.º 11
0
 def testUpdateParamsSeasonSpecified(self):
     params = {"season": "10"}
     Settings.updateParams(params)
     Settings.setRootDirectory("/home/sehicl")
     self.assertEquals("/home/sehicl/data/2009-10.xml", params["xmlFile"])
Exemplo n.º 12
0
 def testUpdateParamsNoSeasonSpecified(self):
     params = {}
     Settings.defaultSeason = 8
     Settings.setRootDirectory("/home/sehicl")
     Settings.updateParams(params)
     self.assertEquals("/home/sehicl/data/2007-08.xml", params["xmlFile"])
Exemplo n.º 13
0
 def testGetNewsDefaultNews(self):
     Settings.setRootDirectory(".")
     result = HomePage("").getNews()
     self.assertTrue(result is not None)
     print(result)
Exemplo n.º 14
0
 def testGetNewsNonEmptyNewsDir(self):
     Settings.setRootDirectory("testData/news/notexpired")
     result = HomePage("").getNews()
     self.assertEquals(1, string.count(result, "<p>"))
Exemplo n.º 15
0
 def testGetNewsExpiredNewsDir(self):
     Settings.setRootDirectory("testData/news/expired")
     result = HomePage("").getNews()
     self.assertEquals("", result)