def test_init_success(self): dir_name = mkdtemp() try: init(dir_name) with open(path.join(dir_name, 'Castorfile')) as f: self.assertTrue(validate_castorfile(f)) with open(path.join(dir_name, '.gitignore')) as f: self.assertEqual('/lodge\n', f.read()) repo = git.Repo(dir_name) self.assertFalse(repo.bare) self.assertFalse(repo.is_dirty()) self.assertEqual(repo.untracked_files, []) finally: rmtree(dir_name)
def test_init_fail_is_file(self): with self.assertRaises(CastorException): init(__file__)
def test_init_fail_dir_has_content(self): with self.assertRaises(CastorException): init(ASSETS_ROOT)
def test_init_fail_does_not_exist(self): with self.assertRaises(CastorException): init(path.join(ASSETS_ROOT, 'this-does-not-exist', 'nope'))