本文整理汇总了Python中twext.python.filepath.CachingFilePath.copyTo方法的典型用法代码示例。如果您正苦于以下问题:Python CachingFilePath.copyTo方法的具体用法?Python CachingFilePath.copyTo怎么用?Python CachingFilePath.copyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twext.python.filepath.CachingFilePath
的用法示例。
在下文中一共展示了CachingFilePath.copyTo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from twext.python.filepath import CachingFilePath [as 别名]
# 或者: from twext.python.filepath.CachingFilePath import copyTo [as 别名]
def setUp(self):
super(ModificationTestCase, self).setUp()
testRoot = os.path.join(os.path.dirname(__file__), "modify")
#configFileName = os.path.join(testRoot, "caldavd.plist")
#config.load(configFileName)
usersFile = os.path.join(testRoot, "users-groups.xml")
config.DirectoryService.params.xmlFile = usersFile
# Copy xml file containing locations/resources to a temp file because
# we're going to be modifying it during testing
origResourcesFile = FilePath(os.path.join(os.path.dirname(__file__),
"modify", "resources-locations.xml"))
copyResourcesFile = FilePath(self.mktemp())
origResourcesFile.copyTo(copyResourcesFile)
config.ResourceService.params.xmlFile = copyResourcesFile
config.ResourceService.Enabled = True
augmentsFile = os.path.join(testRoot, "augments.xml")
config.AugmentService.params.xmlFiles = (augmentsFile,)
示例2: setUp
# 需要导入模块: from twext.python.filepath import CachingFilePath [as 别名]
# 或者: from twext.python.filepath.CachingFilePath import copyTo [as 别名]
def setUp(self):
super(ManagePrincipalsTestCase, self).setUp()
# Since this test operates on proxy db, we need to assign the service:
calendaruserproxy.ProxyDBService = calendaruserproxy.ProxySqliteDB(os.path.abspath(self.mktemp()))
config.GlobalAddressBook.Enabled = False
testRoot = os.path.join(os.path.dirname(__file__), "principals")
templateName = os.path.join(testRoot, "caldavd.plist")
templateFile = open(templateName)
template = templateFile.read()
templateFile.close()
databaseRoot = os.path.abspath("_spawned_scripts_db" + str(os.getpid()))
newConfig = template % {
"ServerRoot" : os.path.abspath(config.ServerRoot),
"DataRoot" : os.path.abspath(config.DataRoot),
"DatabaseRoot" : databaseRoot,
"DocumentRoot" : os.path.abspath(config.DocumentRoot),
"LogRoot" : os.path.abspath(config.LogRoot),
}
configFilePath = FilePath(os.path.join(config.ConfigRoot, "caldavd.plist"))
configFilePath.setContent(newConfig)
self.configFileName = configFilePath.path
config.load(self.configFileName)
origUsersFile = FilePath(os.path.join(os.path.dirname(__file__),
"principals", "users-groups.xml"))
copyUsersFile = FilePath(os.path.join(config.DataRoot, "accounts.xml"))
origUsersFile.copyTo(copyUsersFile)
origResourcesFile = FilePath(os.path.join(os.path.dirname(__file__),
"principals", "resources-locations.xml"))
copyResourcesFile = FilePath(os.path.join(config.DataRoot, "resources.xml"))
origResourcesFile.copyTo(copyResourcesFile)
origAugmentFile = FilePath(os.path.join(os.path.dirname(__file__),
"principals", "augments.xml"))
copyAugmentFile = FilePath(os.path.join(config.DataRoot, "augments.xml"))
origAugmentFile.copyTo(copyAugmentFile)
# Make sure trial puts the reactor in the right state, by letting it
# run one reactor iteration. (Ignore me, please.)
d = Deferred()
reactor.callLater(0, d.callback, True)
return d
示例3: setUp
# 需要导入模块: from twext.python.filepath import CachingFilePath [as 别名]
# 或者: from twext.python.filepath.CachingFilePath import copyTo [as 别名]
def setUp(self):
super(RunCommandTestCase, self).setUp()
testRoot = os.path.join(os.path.dirname(__file__), "gateway")
templateName = os.path.join(testRoot, "caldavd.plist")
templateFile = open(templateName)
template = templateFile.read()
templateFile.close()
databaseRoot = os.path.abspath("_spawned_scripts_db" + str(os.getpid()))
newConfig = template % {
"ServerRoot" : os.path.abspath(config.ServerRoot),
"DatabaseRoot" : databaseRoot,
"WritablePlist" : os.path.join(os.path.abspath(config.ConfigRoot), "caldavd-writable.plist"),
}
configFilePath = FilePath(os.path.join(config.ConfigRoot, "caldavd.plist"))
configFilePath.setContent(newConfig)
self.configFileName = configFilePath.path
config.load(self.configFileName)
origUsersFile = FilePath(os.path.join(os.path.dirname(__file__),
"gateway", "users-groups.xml"))
copyUsersFile = FilePath(os.path.join(config.DataRoot, "accounts.xml"))
origUsersFile.copyTo(copyUsersFile)
origResourcesFile = FilePath(os.path.join(os.path.dirname(__file__),
"gateway", "resources-locations.xml"))
copyResourcesFile = FilePath(os.path.join(config.DataRoot, "resources.xml"))
origResourcesFile.copyTo(copyResourcesFile)
origAugmentFile = FilePath(os.path.join(os.path.dirname(__file__),
"gateway", "augments.xml"))
copyAugmentFile = FilePath(os.path.join(config.DataRoot, "augments.xml"))
origAugmentFile.copyTo(copyAugmentFile)
# Make sure trial puts the reactor in the right state, by letting it
# run one reactor iteration. (Ignore me, please.)
d = Deferred()
reactor.callLater(0, d.callback, True)
return d
示例4: setUp
# 需要导入模块: from twext.python.filepath import CachingFilePath [as 别名]
# 或者: from twext.python.filepath.CachingFilePath import copyTo [as 别名]
def setUp(self):
super(ManagePrincipalsTestCase, self).setUp()
config.GlobalAddressBook.Enabled = False
testRoot = os.path.join(os.path.dirname(__file__), "principals")
templateName = os.path.join(testRoot, "caldavd.plist")
templateFile = open(templateName)
template = templateFile.read()
templateFile.close()
newConfig = template % {
"ServerRoot" : os.path.abspath(config.ServerRoot),
}
configFilePath = FilePath(os.path.join(config.ConfigRoot, "caldavd.plist"))
configFilePath.setContent(newConfig)
self.configFileName = configFilePath.path
config.load(self.configFileName)
origUsersFile = FilePath(os.path.join(os.path.dirname(__file__),
"principals", "users-groups.xml"))
copyUsersFile = FilePath(os.path.join(config.DataRoot, "accounts.xml"))
origUsersFile.copyTo(copyUsersFile)
origResourcesFile = FilePath(os.path.join(os.path.dirname(__file__),
"principals", "resources-locations.xml"))
copyResourcesFile = FilePath(os.path.join(config.DataRoot, "resources.xml"))
origResourcesFile.copyTo(copyResourcesFile)
origAugmentFile = FilePath(os.path.join(os.path.dirname(__file__),
"principals", "augments.xml"))
copyAugmentFile = FilePath(os.path.join(config.DataRoot, "augments.xml"))
origAugmentFile.copyTo(copyAugmentFile)
# Make sure trial puts the reactor in the right state, by letting it
# run one reactor iteration. (Ignore me, please.)
d = Deferred()
reactor.callLater(0, d.callback, True)
return d
示例5: setUp
# 需要导入模块: from twext.python.filepath import CachingFilePath [as 别名]
# 或者: from twext.python.filepath.CachingFilePath import copyTo [as 别名]
def setUp(self):
super(DeprovisionTestCase, self).setUp()
testRootPath = FilePath(__file__).sibling("deprovision")
template = testRootPath.child("caldavd.plist").getContent()
newConfig = template % {
"ServerRoot" : os.path.abspath(config.ServerRoot),
}
configFilePath = FilePath(os.path.join(config.ConfigRoot, "caldavd.plist"))
configFilePath.setContent(newConfig)
self.configFileName = configFilePath.path
config.load(self.configFileName)
origUsersFile = FilePath(__file__).sibling(
"deprovision").child("users-groups.xml")
copyUsersFile = FilePath(config.DataRoot).child("accounts.xml")
origUsersFile.copyTo(copyUsersFile)
origResourcesFile = FilePath(__file__).sibling(
"deprovision").child("resources-locations.xml")
copyResourcesFile = FilePath(config.DataRoot).child("resources.xml")
origResourcesFile.copyTo(copyResourcesFile)
origAugmentFile = FilePath(__file__).sibling(
"deprovision").child("augments.xml")
copyAugmentFile = FilePath(config.DataRoot).child("augments.xml")
origAugmentFile.copyTo(copyAugmentFile)
self.rootResource = getRootResource(config)
self.directory = self.rootResource.getDirectory()
# Make sure trial puts the reactor in the right state, by letting it
# run one reactor iteration. (Ignore me, please.)
d = Deferred()
reactor.callLater(0, d.callback, True)
return d
示例6: setUp
# 需要导入模块: from twext.python.filepath import CachingFilePath [as 别名]
# 或者: from twext.python.filepath.CachingFilePath import copyTo [as 别名]
def setUp(self):
self.serverRoot = self.mktemp()
os.mkdir(self.serverRoot)
self.absoluteServerRoot = os.path.abspath(self.serverRoot)
configRoot = os.path.join(self.absoluteServerRoot, "Config")
if not os.path.exists(configRoot):
os.makedirs(configRoot)
dataRoot = os.path.join(self.absoluteServerRoot, "Data")
if not os.path.exists(dataRoot):
os.makedirs(dataRoot)
documentRoot = os.path.join(self.absoluteServerRoot, "Documents")
if not os.path.exists(documentRoot):
os.makedirs(documentRoot)
logRoot = os.path.join(self.absoluteServerRoot, "Logs")
if not os.path.exists(logRoot):
os.makedirs(logRoot)
runRoot = os.path.join(self.absoluteServerRoot, "Run")
if not os.path.exists(runRoot):
os.makedirs(runRoot)
config.reset()
testRoot = os.path.join(os.path.dirname(__file__), "gateway")
templateName = os.path.join(testRoot, "caldavd.plist")
templateFile = open(templateName)
template = templateFile.read()
templateFile.close()
databaseRoot = os.path.abspath("_spawned_scripts_db" + str(os.getpid()))
newConfig = template % {
"ServerRoot": self.absoluteServerRoot,
"DataRoot": dataRoot,
"DatabaseRoot": databaseRoot,
"DocumentRoot": documentRoot,
"ConfigRoot": configRoot,
"LogRoot": logRoot,
"RunRoot": runRoot,
"WritablePlist": os.path.join(
os.path.abspath(configRoot), "caldavd-writable.plist"
),
}
configFilePath = FilePath(
os.path.join(configRoot, "caldavd.plist")
)
configFilePath.setContent(newConfig)
self.configFileName = configFilePath.path
config.load(self.configFileName)
config.Memcached.Pools.Default.ClientEnabled = False
config.Memcached.Pools.Default.ServerEnabled = False
ClientFactory.allowTestCache = True
memcacher.Memcacher.allowTestCache = True
memcacher.Memcacher.reset()
config.DirectoryAddressBook.Enabled = False
config.UsePackageTimezones = True
origUsersFile = FilePath(
os.path.join(
os.path.dirname(__file__),
"gateway",
"users-groups.xml"
)
)
copyUsersFile = FilePath(
os.path.join(config.DataRoot, "accounts.xml")
)
origUsersFile.copyTo(copyUsersFile)
origResourcesFile = FilePath(
os.path.join(
os.path.dirname(__file__),
"gateway",
"resources-locations.xml"
)
)
copyResourcesFile = FilePath(
os.path.join(config.DataRoot, "resources.xml")
)
origResourcesFile.copyTo(copyResourcesFile)
origAugmentFile = FilePath(
os.path.join(
os.path.dirname(__file__),
"gateway",
"augments.xml"
)
)
copyAugmentFile = FilePath(os.path.join(config.DataRoot, "augments.xml"))
origAugmentFile.copyTo(copyAugmentFile)
self.notifierFactory = StubNotifierFactory()
self.store = yield theStoreBuilder.buildStore(self, self.notifierFactory)
#.........这里部分代码省略.........