Add test_reimported_album_not_preserves_flexattr

Checks if a reimported album flexible attribute "data_source" will be updated
correctly from the match being applied.
This commit is contained in:
J0J0 Todos 2023-03-31 18:55:57 +02:00
parent 42aa989e2d
commit efc88193f9

View file

@ -139,7 +139,8 @@ class AutotagStub:
va=False,
album_id='albumid' + id,
artist_id='artistid' + id,
albumtype='soundtrack'
albumtype='soundtrack',
data_source='match_source'
)
@ -1723,6 +1724,7 @@ class ReimportTest(unittest.TestCase, ImportHelper, _common.Assertions):
album = self.add_album_fixture()
album.added = 4242.0
album.foo = 'bar' # Some flexible attribute.
album.data_source = 'original_source'
album.store()
item = album.items().get()
item.baz = 'qux'
@ -1804,6 +1806,12 @@ class ReimportTest(unittest.TestCase, ImportHelper, _common.Assertions):
if new_artpath != old_artpath:
self.assertNotExists(old_artpath)
def test_reimported_album_not_preserves_flexattr(self):
self._setup_session()
self.assertEqual(self._album().data_source, 'original_source')
self.importer.run()
self.assertEqual(self._album().data_source, 'match_source')
class ImportPretendTest(_common.TestCase, ImportHelper):
""" Test the pretend commandline option