-
Notifications
You must be signed in to change notification settings - Fork 29
/
test_config.py
49 lines (34 loc) · 1.36 KB
/
test_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import os
from os import path
from mock import patch
import config
def test_get_macprefs_dir():
backup_dir = config.get_macprefs_dir()
assert backup_dir is not None
@patch('config.makedirs')
# pylint: disable=unused-argument
def test_get_macprefs_dir_works_with_environ(makedirs_mock):
os.environ['MACPREFS_BACKUP_DIR'] = 'asdf'
backup_dir = config.get_macprefs_dir()
del os.environ['MACPREFS_BACKUP_DIR']
assert 'asdf' in backup_dir
@patch('config.path.exists')
@patch('config.makedirs')
def test_get_macprefs_dir_creates_if_not_exists(exists_mock, makedirs_mock):
exists_mock.return_value = False
config.get_macprefs_dir()
makedirs_mock.assert_called_once()
def test_get_preferences_dir():
assert config.get_preferences_dir() == path.join(
config.get_home_dir(), 'Library/Preferences/')
def test_get_ssh_backup_dir():
assert config.get_ssh_backup_dir() == path.join(
config.get_macprefs_dir(), 'ssh/')
def test_get_ssh_user_dir():
assert config.get_ssh_user_dir() == path.join(
config.get_home_dir(), '.ssh/')
def test_get_shared_file_lists_dir():
path.join(config.get_home_dir(), 'Library/Application Support/com.apple.sharedfilelist/')
def test_get_app_store_preferences_dir():
assert config.get_app_store_preferences_dir() == path.join(
config.get_home_dir(), 'Library/Containers/')