def test_ls_almost_all(self): "Should see most dotfiles" nix.touch(Path(self.tdir) + '.dotrc') self.assertTrue(os.path.isfile(self.tdir + '/.dotrc')) contents = nix.ls(self.tdir, almost_all=True) contents.sort() self.assertEqual(['.dotrc', 'bar.txt', 'foo.txt'], contents)
def test_ls_a_ignore_backups(self): "Should ignore ~ files even with all" nix.touch(Path(self.tdir) + 'dotrc~') self.assertTrue(os.path.isfile(self.tdir + '/dotrc~')) contents = nix.ls(self.tdir, ignore_backups=True, all=True) contents.sort() self.assertEqual(['.', '..', 'bar.txt', 'foo.txt'], contents)
def test_ls_dotfile(self): "Shouldn't see dotfiles" nix.touch(Path(self.tdir) + '.dotrc') self.assertTrue(os.path.isfile(self.tdir + '/.dotrc')) contents = nix.ls(Path(self.tdir)) contents.sort() self.assertEqual(['bar.txt', 'foo.txt'], contents)
def test_ls_path(self): "list files in dir" contents = nix.ls(Path(self.tdir)) contents.sort() self.assertEqual(['bar.txt', 'foo.txt'], contents)
def ls(self, resource, all=None): return nix.ls(resource, all=all)