def test_permissions_on_album_imported(self): self.importer = self.create_importer() self.importer.run() item = self.lib.items().get() config_perm = self.config['permissions']['file'].get() config_perm = convert_perm(config_perm) self.assertTrue(check_permissions(item.path, config_perm)) self.assertFalse(check_permissions(item.path, convert_perm(644)))
def assertPerms(self, path, typ, expect_success): # noqa for x in [(True, self.exp_perms[expect_success][typ], '!='), (False, self.exp_perms[not expect_success][typ], '==')]: msg = '{} : {} {} {}'.format(displayable_path(path), oct(os.stat(path).st_mode), x[2], oct(x[1])) self.assertEqual(x[0], check_permissions(path, x[1]), msg=msg)
def assertPerms(self, path, typ, expectSuccess): for x in [(True, self.exp_perms[expectSuccess][typ], '!='), (False, self.exp_perms[not expectSuccess][typ], '==')]: self.assertEqual(x[0], check_permissions(path, x[1]), msg='{} : {} {} {}'.format( path, oct(os.stat(path).st_mode), x[2], oct(x[1])))
def assertPerms(self, path, typ, expect_success): # noqa for x in [(True, self.exp_perms[expect_success][typ], '!='), (False, self.exp_perms[not expect_success][typ], '==')]: msg = u'{} : {} {} {}'.format( displayable_path(path), oct(os.stat(path).st_mode), x[2], oct(x[1]) ) self.assertEqual(x[0], check_permissions(path, x[1]), msg=msg)
def test_permissions_on_album_imported(self): self.importer = self.create_importer() self.importer.run() item = self.lib.items().get() file_perm = self.config['permissions']['file'].get() file_perm = convert_perm(file_perm) dir_perm = self.config['permissions']['dir'].get() dir_perm = convert_perm(dir_perm) music_dirs = dirs_in_library(self.lib.directory, item.path) self.assertTrue(check_permissions(item.path, file_perm)) self.assertFalse(check_permissions(item.path, convert_perm(644))) for path in music_dirs: self.assertTrue(check_permissions(path, dir_perm)) self.assertFalse(check_permissions(path, convert_perm(644)))
def do_set_art(self, expect_success): if platform.system() == 'Windows': self.skipTest('permissions not available on Windows') self.importer = self.create_importer() self.importer.run() album = self.lib.albums().get() artpath = os.path.join(self.temp_dir, b'cover.jpg') touch(artpath) album.set_art(artpath) self.assertEqual(expect_success, check_permissions(album.artpath, 0o777))