Test the update function
(self)
| 25 | CONFIG_NAME = 'config.yaml' |
| 26 | |
| 27 | def test_update(self): |
| 28 | """Test the update function""" |
| 29 | # setup some directories |
| 30 | fold_config = os.path.join(os.path.expanduser('~'), '.config') |
| 31 | create_dir(fold_config) |
| 32 | fold_subcfg = os.path.join(os.path.expanduser('~'), '.config', |
| 33 | get_string(5)) |
| 34 | create_dir(fold_subcfg) |
| 35 | self.addCleanup(clean, fold_subcfg) |
| 36 | fold_tmp = get_tempdir() |
| 37 | create_dir(fold_tmp) |
| 38 | self.addCleanup(clean, fold_tmp) |
| 39 | |
| 40 | # create the directories |
| 41 | tmp = get_tempdir() |
| 42 | self.assertTrue(os.path.exists(tmp)) |
| 43 | self.addCleanup(clean, tmp) |
| 44 | |
| 45 | dotfilespath = get_tempdir() |
| 46 | self.assertTrue(os.path.exists(dotfilespath)) |
| 47 | self.addCleanup(clean, dotfilespath) |
| 48 | |
| 49 | # create the dotfiles to test |
| 50 | dotfilefile1, _ = create_random_file(fold_config) |
| 51 | self.assertTrue(os.path.exists(dotfilefile1)) |
| 52 | self.addCleanup(clean, dotfilefile1) |
| 53 | |
| 54 | dotfilefile2, _ = create_random_file(fold_config) |
| 55 | self.assertTrue(os.path.exists(dotfilefile2)) |
| 56 | self.addCleanup(clean, dotfilefile2) |
| 57 | |
| 58 | # template |
| 59 | d3t, _ = create_random_file(fold_config) |
| 60 | self.assertTrue(os.path.exists(d3t)) |
| 61 | self.addCleanup(clean, d3t) |
| 62 | |
| 63 | # sub dirs |
| 64 | dsubstmp = get_tempdir() |
| 65 | self.assertTrue(os.path.exists(dsubstmp)) |
| 66 | self.addCleanup(clean, dsubstmp) |
| 67 | dirsubs = os.path.basename(dsubstmp) |
| 68 | |
| 69 | dir1string = 'somedir' |
| 70 | dir1 = os.path.join(dsubstmp, dir1string) |
| 71 | create_dir(dir1) |
| 72 | dir1sub1str = 'sub1' |
| 73 | sub1 = os.path.join(dir1, dir1sub1str) |
| 74 | create_dir(sub1) |
| 75 | dir1sub2str = 'sub2' |
| 76 | sub2 = os.path.join(dir1, dir1sub2str) |
| 77 | create_dir(sub2) |
| 78 | f1s1, _ = create_random_file(sub1) |
| 79 | self.assertTrue(os.path.exists(f1s1)) |
| 80 | f1s2, _ = create_random_file(sub2) |
| 81 | self.assertTrue(os.path.exists(f1s2)) |
| 82 | |
| 83 | # create the directory to test |
| 84 | dpath = os.path.join(fold_config, get_string(5)) |
nothing calls this directly
no test coverage detected