def test_overwrite(self): ctrl = TestCaseFileController(TestCaseFile(source=self._filepath).populate(), create_project()) os.utime(self._filepath, (1,1)) assert_true(ctrl.has_been_modified_on_disk()) ctrl.execute(SaveFile()) assert_false(ctrl.has_been_modified_on_disk())
def test_overwrite(self): ctrl = TestCaseFileController(TestCaseFile(source=self._filepath).populate(), ChiefController(Namespace())) os.utime(self._filepath, (1,1)) assert_true(ctrl.has_been_modified_on_disk()) ctrl.save() assert_false(ctrl.has_been_modified_on_disk())
def test_size_change(self): os.utime(self._filepath, None) ctrl = TestCaseFileController(TestCaseFile(source=self._filepath).populate()) open(self._filepath, 'a').write('#Ninja edit\n') assert_true(ctrl.has_been_modified_on_disk())
def test_mtime(self): ctrl = TestCaseFileController(TestCaseFile(source=self._filepath).populate()) assert_false(ctrl.has_been_modified_on_disk()) os.utime(self._filepath, (1,1)) assert_true(ctrl.has_been_modified_on_disk())
def test_size_change(self): os.utime(self._filepath, None) ctrl = TestCaseFileController(TestCaseFile(source=self._filepath).populate()) with open(self._filepath, 'a') as file: file.write('#Ninja edit\n') assert_true(ctrl.has_been_modified_on_disk())