Beispiel #1
0
    def test_shouldFindAnErrorInAWriteLocThatContainsANonWriteLoc(self, fix):
        validator = self.construct()

        strToTest(
            validator.validate([
                fix.validRule(),
                fix.mockRule("/mnt/data/foo", "/mnt/data")
            ])[0]).shouldIncludeInOrder("foo", "within", "/mnt")

        assert len(validator.validate([fix.mockRule("/src", "/src")])) > 0

        assert len(validator.validate([fix.mockRule("/", "/mnt/backup")])) == 0
Beispiel #2
0
 def test_shouldReturnAnErrorIfTheLocARuleWritesToIsWithinThatOfASecond(
         self, fix):
     validator = self.construct()
     assert "overlapping" in validator.validate([
         fix.mockRule("/src/1", "/dest/1"),
         fix.mockRule("/src/2", "/dest/1/foo")
     ])[0]
     assert len(
         validator.validate([
             fix.mockRule("/src/1", "/dest/1"),
             fix.mockRule("/dest/1", "/dest/2", writeLocs=[1, 2])
         ])) == 1
Beispiel #3
0
 def invalidRule(locCheckLevel):
     return fix.mockRule(fix.validLocDir(),
                         emptyDir,
                         options={"LocCheckLevel": locCheckLevel})
Beispiel #4
0
 def test_shouldSeeItAsAnErrorIfALocIsAFile(self, fix):
     validator = self.construct()
     aFile = fix.tmpdir.join("file")
     aFile.write("")
     assert "is file" in validator.validate(
         [fix.mockRule(aFile, fix.validLocDir())])[0]
Beispiel #5
0
 def invalidRule(self, fix, ruleName, options=None):
     return fix.mockRule(fix.validLocDir(),
                         "/does/not/exist",
                         name=ruleName,
                         options=options)
Beispiel #6
0
  def test_shouldReturnAnErrorIfLoc1EqualsLoc2(self, fix):
    validator = self.construct()

    locDir = fix.validLocDir()
    assert len(validator.validate(ruleSet(
      fix.mockRule(locDir, locDir)))) > 0