def testDependencyCommandExecutedByCleanTree(self): f1 = Mock(name="f1") f2 = Mock(name="f2") f1.fname = "file1" f2.fname = "file2" mockDependency = mock.Mock(name="dependency") mockDependency.clean = mock.Mock(return_value = None) mockDependency.targets = [f2] f1.successors = [mockDependency] f2.successors = [] self.mrv.files = [f1, f2] self.mrv.cleanTree(f1) mockDependency.clean.assert_called_once_with(".")
def testTreeCleanedIfFileChanged(self, fileState): # need to mock FileState creation since it gets called with a path which doesnt have "/" at the beginning, which induces errors self.mrv.cleanTree = Mock(name="cleantree") f1 = Mock(name="filestate") f1.fname = "file1" self.mrv.files = [f1] self.mrv.notifyChanged("file1") self.mrv.handle() self.mrv.cleanTree.assert_called_once_with(f1)
def testDependenciesAddedWhenFileCreated(self, fileState): self.mrv.cleanTree = Mock(name="cleantree") self.mrv.dependencyManager = Mock(name="dependencyManager") f1 = Mock(name="filestate") f1.fname = "file1" self.mrv.files = [f1] self.mrv.notifyChanged("file2") assert(len(self.mrv.files) == 2) f2 = self.mrv.files[1] self.mrv.handle() self.mrv.cleanTree.assert_called_once_with(f2) self.mrv.dependencyManager.update.assert_called_once_with(f2)