| 1 |
from mediafile import MediaFile |
| 2 |
|
| 3 |
from beets.test.helper import AsIsImporterMixin, ImportHelper, PluginMixin |
| 4 |
|
| 5 |
|
| 6 |
class TestScrubbedImport(AsIsImporterMixin, PluginMixin, ImportHelper): |
| 7 |
db_on_disk = True |
| 8 |
plugin = "scrub" |
| 9 |
|
| 10 |
def test_tags_not_scrubbed(self): |
| 11 |
with self.configure_plugin({"auto": False}): |
| 12 |
self.run_asis_importer(write=True) |
| 13 |
|
| 14 |
for item in self.lib.items(): |
| 15 |
imported_file = MediaFile(item.filepath) |
| 16 |
assert imported_file.artist == "Tag Artist" |
| 17 |
assert imported_file.album == "Tag Album" |
| 18 |
|
| 19 |
def test_tags_restored(self): |
| 20 |
with self.configure_plugin({"auto": True}): |
| 21 |
self.run_asis_importer(write=True) |
| 22 |
|
| 23 |
for item in self.lib.items(): |
| 24 |
imported_file = MediaFile(item.filepath) |
| 25 |
assert imported_file.artist == "Tag Artist" |
| 26 |
assert imported_file.album == "Tag Album" |
| 27 |
|
| 28 |
def test_tags_not_scrubbed_when_nowrite(self): |
| 29 |
"""When --nowrite is passed, scrubbing should be skipped entirely.""" |
| 30 |
with self.configure_plugin({"auto": True}): |
| 31 |
self.run_asis_importer(write=False) |
| 32 |
|
| 33 |
for item in self.lib.items(): |
| 34 |
imported_file = MediaFile(item.filepath) |
| 35 |
assert imported_file.artist == "Tag Artist" |
| 36 |
assert imported_file.album == "Tag Album" |