12345678910111213141516171819202122232425262728293031 |
- import os
- import re
- import unittest.mock
- from symuid import Track
- from symuid.sync import _main, sync
- DUMMY_PATH_IGNORE_REGEX = re.compile(r'\.jpg$')
- def test_sync(empty_ogg_opus_path):
- assert Track(empty_ogg_opus_path).get_uuid() is None
- sync(os.path.dirname(empty_ogg_opus_path),
- path_ignore_regex=DUMMY_PATH_IGNORE_REGEX)
- assert Track(empty_ogg_opus_path).get_uuid() is not None
- def test_sync_idempotent(empty_ogg_opus_path):
- sync(os.path.dirname(empty_ogg_opus_path),
- path_ignore_regex=DUMMY_PATH_IGNORE_REGEX)
- uuid = Track(empty_ogg_opus_path).get_uuid()
- sync(os.path.dirname(empty_ogg_opus_path),
- path_ignore_regex=DUMMY_PATH_IGNORE_REGEX)
- assert Track(empty_ogg_opus_path).get_uuid() == uuid
- def test_main(empty_ogg_opus_path):
- assert Track(empty_ogg_opus_path).get_uuid() is None
- with unittest.mock.patch('sys.argv', ['', os.path.dirname(empty_ogg_opus_path)]):
- _main()
- assert Track(empty_ogg_opus_path).get_uuid() is not None
|