def testAddRepository(self):
     # addRepository(rep)
     config = IceConfig(self.context)
     rep = config.createNewRepository("Name", "Url", "Path",
                                     "DocTemplatesPath", "ExportPath")
     config.addRepository(rep)
     self.assertEquals(config.getRepNames(), ["Name"])
 def testSave(self):
     config = IceConfig(self.context)
     saveStr = [None]
     def saveMethod(xmlStr):
         saveStr[0] = xmlStr
     config.save(saveMethod)
     self.assertEquals(saveStr[0], config.serialize())
Exemplo n.º 3
0
    def testSave(self):
        config = IceConfig(self.context)
        saveStr = [None]

        def saveMethod(xmlStr):
            saveStr[0] = xmlStr

        config.save(saveMethod)
        self.assertEquals(saveStr[0], config.serialize())
    def testSerialize(self):
        expected1 = """<iceConfig version="2.0">
	<iceWebHost>localhost</iceWebHost>
	<iceWebPort>8000</iceWebPort>
	<iceWebServer>Paste</iceWebServer>
	<settings />
	<repositories />
</iceConfig>"""
        config = IceConfig(self.context)
        self.assertEquals(config.serialize(), expected1)
        config.settings.set("key", "value")
        e = expected1
        e = e.replace("<settings />", '<settings>\n\t\t<var name="key" type="string" value="value" />\n\t</settings>')
        self.assertEquals(config.serialize(), e)
Exemplo n.º 5
0
 def testDeleteRepository(self):
     # deleteRepository(name)
     config = IceConfig(self.context)
     config.process(testConfig2XmlStr)
     self.assertEquals(config.getRepNames(), ["ONE", "TWO"])
     config.deleteRepository("ONE")
     self.assertEquals(config.getRepNames(), ["TWO"])
Exemplo n.º 6
0
    def testSerialize(self):
        expected1 = """<iceConfig version="2.0">
	<iceWebHost>localhost</iceWebHost>
	<iceWebPort>8000</iceWebPort>
	<iceWebServer>Paste</iceWebServer>
	<settings />
	<repositories />
</iceConfig>"""
        config = IceConfig(self.context)
        self.assertEquals(config.serialize(), expected1)
        config.settings.set("key", "value")
        e = expected1
        e = e.replace(
            "<settings />",
            '<settings>\n\t\t<var name="key" type="string" value="value" />\n\t</settings>'
        )
        self.assertEquals(config.serialize(), e)
 def testDeleteRepository(self):
     # deleteRepository(name)
     config = IceConfig(self.context)
     config.process(testConfig2XmlStr)
     self.assertEquals(config.getRepNames(), ["ONE", "TWO"])
     config.deleteRepository("ONE")
     self.assertEquals(config.getRepNames(), ["TWO"])
Exemplo n.º 8
0
 def testAddRepository(self):
     # addRepository(rep)
     config = IceConfig(self.context)
     rep = config.createNewRepository("Name", "Url", "Path",
                                      "DocTemplatesPath", "ExportPath")
     config.addRepository(rep)
     self.assertEquals(config.getRepNames(), ["Name"])
 def testProcessAndProperties(self):
     # Properties:
     #   settings
     #   defaultRepositoryName
     #   port
     #   hostAddress
     #   repositories
     config = IceConfig(self.context)
     config.process(testConfig2XmlStr)
     self.assertEquals(config.settings["testDefault"], "Default")
     self.assertEquals(config.defaultRepositoryName, "TWO")
     self.assertEquals(config.port, "8000")
     self.assertEquals(config.hostAddress, "127.0.0.1")
     reps = {}
     for r in config.repositories:
         reps[r.name] = r
         #print r.name, r.settings
     rep1 = reps["ONE"]
     rep2 = reps["TWO"]
     self.assertEquals(rep1.settings["testDefault"], "Default")
     self.assertEquals(rep1.settings.get("test", "not set"), "not set")
     self.assertEquals(rep2.settings["testDefault"], "OverriddenValue")
     self.assertEquals(rep2.settings.get("test", "not set"), "Testing")
Exemplo n.º 10
0
 def testProcessAndProperties(self):
     # Properties:
     #   settings
     #   defaultRepositoryName
     #   port
     #   hostAddress
     #   repositories
     config = IceConfig(self.context)
     config.process(testConfig2XmlStr)
     self.assertEquals(config.settings["testDefault"], "Default")
     self.assertEquals(config.defaultRepositoryName, "TWO")
     self.assertEquals(config.port, "8000")
     self.assertEquals(config.hostAddress, "127.0.0.1")
     reps = {}
     for r in config.repositories:
         reps[r.name] = r
         #print r.name, r.settings
     rep1 = reps["ONE"]
     rep2 = reps["TWO"]
     self.assertEquals(rep1.settings["testDefault"], "Default")
     self.assertEquals(rep1.settings.get("test", "not set"), "not set")
     self.assertEquals(rep2.settings["testDefault"], "OverriddenValue")
     self.assertEquals(rep2.settings.get("test", "not set"), "Testing")
Exemplo n.º 11
0
    def setUp(self):
        class Object(object):
            pass

        def getOsHomeDirectory():
            return "/home/user/"

        def readFile(file):
            return "[file: %s contents]" % file

        def textToHtml(s):
            return s

        self.context = Object()
        self.context.ElementTree = ElementTree
        self.context.system = Object()
        self.context.system.getOsHomeDirectory = getOsHomeDirectory
        self.context.fs = Object()
        self.context.fs.readFile = readFile
        self.context.textToHtml = textToHtml
        self.context.versionInfoSummary = "ICE version info summary."
        self.context.config = IceConfig(self.context)
        self.context.config.process(testConfig2XmlStr)
 def testSetDefaultRepositoryName(self):
     config = IceConfig(self.context)
     self.assertEquals(config.defaultRepositoryName, None)
     config.setDefaultRepositoryName("ONE")
     self.assertEquals(config.defaultRepositoryName, "ONE")
     self.assertEquals(config.settings["defaultRepositoryName"], "ONE")
Exemplo n.º 13
0
 def testGetRep(self):
     # getRep(name)
     config = IceConfig(self.context)
     config.process(testConfig2XmlStr)
     rep = config.getRep("ONE")
     self.assertEquals(rep.name, "ONE")
Exemplo n.º 14
0
 def testGetRepNames(self):
     # getRepNames()
     config = IceConfig(self.context)
     config.process(testConfig2XmlStr)
     self.assertEquals(config.getRepNames(), ["ONE", "TWO"])
 def testGetRepNames(self):
     # getRepNames()
     config = IceConfig(self.context)
     config.process(testConfig2XmlStr)
     self.assertEquals(config.getRepNames(), ["ONE", "TWO"])
 def testGetRep(self):
     # getRep(name)
     config = IceConfig(self.context)
     config.process(testConfig2XmlStr)
     rep = config.getRep("ONE")
     self.assertEquals(rep.name, "ONE")
Exemplo n.º 17
0
 def testSetDefaultRepositoryName(self):
     config = IceConfig(self.context)
     self.assertEquals(config.defaultRepositoryName, None)
     config.setDefaultRepositoryName("ONE")
     self.assertEquals(config.defaultRepositoryName, "ONE")
     self.assertEquals(config.settings["defaultRepositoryName"], "ONE")