Esempio n. 1
0
    def testD(self):
        """build/dir/file structure manipulators"""
        step = WMStep("CoreHelperTest")
        template = Template()
        template.coreInstall(step)
        helper = CoreHelper(step)

        try:
            helper.addDirectory("dir1")
            helper.addDirectory("dir1/dir2")
            helper.addDirectory("dir1/dir3")
            helper.addDirectory("dir1/dir4")
            helper.addDirectory("/dir1/dir5")
        except Exception as ex:
            msg = "Error calling CoreHelper.addDirectory\n"
            msg += str(ex)
            self.fail(msg)

        dirs = helper.directoryStructure()
        self.assertTrue(hasattr(dirs, helper.stepName()))

        stepDir = getattr(dirs, helper.stepName())
        self.assertTrue(hasattr(stepDir, "dir1"))
        dir1 = getattr(stepDir, "dir1")
        dir2 = getattr(dir1, "dir2")

        self.assertTrue(hasattr(dir1, "dir2"))
        self.assertTrue(hasattr(dir1, "dir3"))
        self.assertTrue(hasattr(dir1, "dir4"))
        self.assertTrue(hasattr(dir1, "dir5"))



        helper.addFile("file1")
        helper.addFile("file2", "dir1/dir2/file2")

        self.assertTrue(hasattr(stepDir, "file1"))
        self.assertTrue(hasattr(dir2, "file2"))

        file1 = getattr(stepDir, "file1")
        file2 = getattr(dir2, "file2")

        self.assertEqual(file1['Source'], "file1")
        self.assertEqual(file1['Target'], "file1")

        self.assertEqual(file2['Source'], "file2")
        self.assertEqual(file2['Target'], "file2")
Esempio n. 2
0
    def testB(self):
        """test stepName"""
        stepName = "StepNameGoesHere"
        helper = CoreHelper(WMStep(stepName))

        try:
            name = helper.stepName()
        except Exception, ex:
            msg = "Failed to call CoreHelper.stepName:\n"
            msg += str(ex)
            self.fail(msg)