mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 16:42:42 +01:00
Move scrub test to a separate file
This commit is contained in:
parent
7ff73d9747
commit
33bed79a13
2 changed files with 37 additions and 47 deletions
37
test/plugins/test_scrub.py
Normal file
37
test/plugins/test_scrub.py
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
from mediafile import MediaFile
|
||||||
|
|
||||||
|
from beets.test.helper import AsIsImporterMixin, ImportTestCase, PluginMixin
|
||||||
|
|
||||||
|
|
||||||
|
class ScrubbedImportTest(AsIsImporterMixin, PluginMixin, ImportTestCase):
|
||||||
|
db_on_disk = True
|
||||||
|
plugin = "scrub"
|
||||||
|
|
||||||
|
def test_tags_not_scrubbed(self):
|
||||||
|
with self.configure_plugin({"auto": False}):
|
||||||
|
self.run_asis_importer(write=True)
|
||||||
|
|
||||||
|
for item in self.lib.items():
|
||||||
|
imported_file = MediaFile(os.path.join(item.path))
|
||||||
|
assert imported_file.artist == "Tag Artist"
|
||||||
|
assert imported_file.album == "Tag Album"
|
||||||
|
|
||||||
|
def test_tags_restored(self):
|
||||||
|
with self.configure_plugin({"auto": True}):
|
||||||
|
self.run_asis_importer(write=True)
|
||||||
|
|
||||||
|
for item in self.lib.items():
|
||||||
|
imported_file = MediaFile(os.path.join(item.path))
|
||||||
|
assert imported_file.artist == "Tag Artist"
|
||||||
|
assert imported_file.album == "Tag Album"
|
||||||
|
|
||||||
|
def test_tags_not_restored(self):
|
||||||
|
with self.configure_plugin({"auto": True}):
|
||||||
|
self.run_asis_importer(write=False)
|
||||||
|
|
||||||
|
for item in self.lib.items():
|
||||||
|
imported_file = MediaFile(os.path.join(item.path))
|
||||||
|
assert imported_file.artist is None
|
||||||
|
assert imported_file.album is None
|
||||||
|
|
@ -50,53 +50,6 @@ from beets.test.helper import (
|
||||||
from beets.util import bytestring_path, displayable_path, syspath
|
from beets.util import bytestring_path, displayable_path, syspath
|
||||||
|
|
||||||
|
|
||||||
class ScrubbedImportTest(AsIsImporterMixin, PluginMixin, ImportTestCase):
|
|
||||||
db_on_disk = True
|
|
||||||
plugin = "scrub"
|
|
||||||
|
|
||||||
def test_tags_not_scrubbed(self):
|
|
||||||
config["plugins"] = ["scrub"]
|
|
||||||
config["scrub"]["auto"] = False
|
|
||||||
config["import"]["write"] = True
|
|
||||||
for mediafile in self.import_media:
|
|
||||||
assert mediafile.artist == "Tag Artist"
|
|
||||||
assert mediafile.album == "Tag Album"
|
|
||||||
self.run_asis_importer()
|
|
||||||
for item in self.lib.items():
|
|
||||||
imported_file = os.path.join(item.path)
|
|
||||||
imported_file = MediaFile(imported_file)
|
|
||||||
assert imported_file.artist == "Tag Artist"
|
|
||||||
assert imported_file.album == "Tag Album"
|
|
||||||
|
|
||||||
def test_tags_restored(self):
|
|
||||||
config["plugins"] = ["scrub"]
|
|
||||||
config["scrub"]["auto"] = True
|
|
||||||
config["import"]["write"] = True
|
|
||||||
for mediafile in self.import_media:
|
|
||||||
assert mediafile.artist == "Tag Artist"
|
|
||||||
assert mediafile.album == "Tag Album"
|
|
||||||
self.run_asis_importer()
|
|
||||||
for item in self.lib.items():
|
|
||||||
imported_file = os.path.join(item.path)
|
|
||||||
imported_file = MediaFile(imported_file)
|
|
||||||
assert imported_file.artist == "Tag Artist"
|
|
||||||
assert imported_file.album == "Tag Album"
|
|
||||||
|
|
||||||
def test_tags_not_restored(self):
|
|
||||||
config["plugins"] = ["scrub"]
|
|
||||||
config["scrub"]["auto"] = True
|
|
||||||
config["import"]["write"] = False
|
|
||||||
for mediafile in self.import_media:
|
|
||||||
assert mediafile.artist == "Tag Artist"
|
|
||||||
assert mediafile.album == "Tag Album"
|
|
||||||
self.run_asis_importer()
|
|
||||||
for item in self.lib.items():
|
|
||||||
imported_file = os.path.join(item.path)
|
|
||||||
imported_file = MediaFile(imported_file)
|
|
||||||
assert imported_file.artist is None
|
|
||||||
assert imported_file.album is None
|
|
||||||
|
|
||||||
|
|
||||||
@_common.slow_test()
|
@_common.slow_test()
|
||||||
class NonAutotaggedImportTest(AsIsImporterMixin, ImportTestCase):
|
class NonAutotaggedImportTest(AsIsImporterMixin, ImportTestCase):
|
||||||
db_on_disk = True
|
db_on_disk = True
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue