예제 #1
0
 def test_validate(self):
     expected = warnings.ValidationWarning("Empty Page Name",
                                           "This page has no name.",
                                           self.page)
     assert expected in self.page.validate()
     expected = warnings.ValidationWarning("Empty Page",
                                           "This page is empty.", self.page)
     assert expected in self.page.validate()
예제 #2
0
 def test_validate(self):
     expected = warnings.ValidationWarning(
         "Empty Type Descriptor",
         "This type descriptor is empty and will never set a type.",
         self.type,
         critical=True,
     )
     assert expected in self.type.validate()
예제 #3
0
 def test_validate(self):
     expected = [
         warnings.ValidationWarning("Empty Option Name",
                                    "This option has no name.",
                                    self.option),
         warnings.ValidationWarning(
             "Empty Option Description",
             "This option has no description.",
             self.option,
         ),
         warnings.ValidationWarning(
             "Option Does Nothing",
             "This option installs no files and sets no flags.",
             self.option,
         ),
     ]
     assert self.option.validate() == expected
예제 #4
0
 def test_validate(self):
     expected = warnings.ValidationWarning(
         "Empty Source Field",
         "No source specified, this could lead to problems installing.",
         self.file,
         critical=True,
     )
     assert expected in self.file.validate()
예제 #5
0
 def test_validate(self):
     expected = warnings.ValidationWarning(
         "Empty Fomod Tree",
         "This fomod is empty, nothing will be installed.",
         self.root,
     )
     assert expected in self.root.validate()
     page = fomod.Page()
     page.conditions["boop"] = "beep"
     page.append(fomod.Group())
     self.root.pages.append(page)
     expected = warnings.ValidationWarning(
         "Impossible Flag",
         "The flag 'boop' is never created or set.",
         page.conditions,
         critical=True,
     )
     assert expected in self.root.validate()
예제 #6
0
 def test_validate(self):
     expected = warnings.ValidationWarning(
         "Empty Conditions",
         "This element should have at least one condition present.",
         self.cond,
         critical=False,
     )
     assert expected in self.cond.validate()
     nest = fomod.Conditions()
     self.cond[nest] = None
     expected = warnings.ValidationWarning(
         "Empty Conditions",
         "This element should have at least one condition present.",
         nest,
         critical=False,
     )
     assert expected in self.cond.validate()
     self.cond[None] = ""
     expected = warnings.ValidationWarning(
         "Empty Version Dependency", "This version dependency is empty.",
         self.cond)
     assert expected in self.cond.validate()
     self.cond[""] = fomod.FileType.ACTIVE
     expected = warnings.ValidationWarning(
         "Empty File Dependency",
         "This file dependency depends on no file, may not work correctly.",
         self.cond,
     )
     assert expected in self.cond.validate()
     self.cond._tag = "moduleDependencies"
     self.cond["boop"] = "beep"
     expected = warnings.ValidationWarning(
         "Impossible Flag",
         "Flag boop shouldn't be used here since it can't have been set.",
         self.cond,
         critical=True,
     )
     assert expected in self.cond.validate()
예제 #7
0
    def test_validate(self):
        expected = warnings.ValidationWarning("Empty Group",
                                              "This group is empty.",
                                              self.group)
        assert expected in self.group.validate()
        expected = warnings.ValidationWarning("Empty Group Name",
                                              "This group has no name.",
                                              self.group)
        assert expected in self.group.validate()

        self.group.type = fomod.GroupType.ATLEASTONE
        expected = warnings.ValidationWarning(
            "Not Enough Selectable Options",
            "This group needs at least one selectable "
            "option but none are available.",
            self.group,
            critical=True,
        )
        assert expected in self.group.validate()

        self.group.type = fomod.GroupType.EXACTLYONE
        expected = warnings.ValidationWarning(
            "Not Enough Selectable Options",
            "This group needs exactly one selectable "
            "option but none are available.",
            self.group,
            critical=True,
        )
        assert expected in self.group.validate()

        option1 = fomod.Option()
        option1.type = fomod.OptionType.REQUIRED
        self.group.append(option1)
        option2 = fomod.Option()
        option2.type = fomod.OptionType.REQUIRED
        self.group.append(option2)

        self.group.type = fomod.GroupType.ATMOSTONE
        expected = warnings.ValidationWarning(
            "Too Many Required Options",
            "This group can have one option selected "
            "at most but at least two are required.",
            self.group,
            critical=True,
        )
        assert expected in self.group.validate()

        self.group.type = fomod.GroupType.EXACTLYONE
        expected = warnings.ValidationWarning(
            "Too Many Required Options",
            "This group can only have exactly one "
            "option selected but at least two are required.",
            self.group,
            critical=True,
        )
        assert expected in self.group.validate()
예제 #8
0
 def test_validate(self):
     expected = warnings.ValidationWarning(
         "Missing Installer Name", "This fomod does not have a name.",
         self.name)
     assert expected in self.name.validate()