Test the install function
(self)
| 75 | ''' |
| 76 | |
| 77 | def test_jhelpers(self): |
| 78 | """Test the install function""" |
| 79 | |
| 80 | # dotpath location |
| 81 | tmp = get_tempdir() |
| 82 | self.assertTrue(os.path.exists(tmp)) |
| 83 | self.addCleanup(clean, tmp) |
| 84 | |
| 85 | # where dotfiles will be installed |
| 86 | dst = get_tempdir() |
| 87 | self.assertTrue(os.path.exists(dst)) |
| 88 | self.addCleanup(clean, dst) |
| 89 | |
| 90 | # create the dotfile in dotdrop |
| 91 | file1, _ = create_random_file(tmp) |
| 92 | with open(file1, 'w', encoding='utf-8') as file: |
| 93 | file.write(self.TEMPLATE) |
| 94 | dst1 = os.path.join(dst, get_string(6)) |
| 95 | dotfile1 = Dotfile(get_string(5), dst1, os.path.basename(file1)) |
| 96 | |
| 97 | # generate the config and stuff |
| 98 | profile = get_string(5) |
| 99 | confpath = os.path.join(tmp, self.CONFIG_NAME) |
| 100 | fake_config(confpath, dotfile1, profile, tmp) |
| 101 | conf = CfgAggregator(confpath, profile, debug=True) |
| 102 | self.assertTrue(conf is not None) |
| 103 | |
| 104 | # install them |
| 105 | opt = load_options(confpath, profile) |
| 106 | opt.safe = False |
| 107 | opt.install_showdiff = True |
| 108 | opt.variables = {} |
| 109 | opt.debug = True |
| 110 | cmd_install(opt) |
| 111 | |
| 112 | # now compare the generated files |
| 113 | self.assertTrue(os.path.exists(dst1)) |
| 114 | f1content = '' |
| 115 | with open(dst1, 'r', encoding='utf-8') as file: |
| 116 | f1content = file.read() |
| 117 | self.assertTrue(f1content == self.RESULT) |
| 118 | |
| 119 | |
| 120 | def main(): |
nothing calls this directly
no test coverage detected