def test_success_with_template_dir(self): settings_str = ( """ [kittyconfig] auth = tests.test_utils.AllAuth [kittygit] repo_dir = %s """.strip() % self.test_dir ) test_settings = fake_settings(settings_str) user = "******" % random.randint(0, 100) repo_name = "repo-%d" % random.randint(0, 100) repo = "%s/%s.git" % (user, repo_name) with open("/dev/null", "w") as out_stream: with open("/dev/null", "w") as err_stream: streams = (sys.stdin, out_stream, err_stream) request = Request(user, "kitty-git create-repo 'repo'", test_settings, streams) settings = handlers.get_settings(request) full_repo_dir = utils.get_full_repo_dir(settings, user, repo_name) result = handlers.create_repo(request, repo_name, os.path.join(os.getcwd(), "tests/support")) self.assertTrue(user in result) self.assertTrue(repo_name in result) self.assertTrue(os.path.isdir(full_repo_dir)) self.assertTrue(os.path.isfile("tests/support/hooks/post-commit")) import time time.sleep(1) # pass the time for a bit for things to # flush to disk self.assertTrue(os.path.isfile("%s/hooks/post-commit" % full_repo_dir))
def test_success(self): settings_str = ( """ [kittyconfig] auth = tests.test_utils.AllAuth [kittygit] repo_dir = %s """.strip() % self.test_dir ) test_settings = fake_settings(settings_str) user = "******" % random.randint(0, 100) repo_name = "repo-%d" % random.randint(0, 100) repo = "%s/%s.git" % (user, repo_name) with open("/dev/null", "w") as out_stream: with open("/dev/null", "w") as err_stream: streams = (sys.stdin, out_stream, err_stream) request = Request(user, "kitty-git create-repo 'repo'", test_settings, streams) settings = handlers.get_settings(request) full_repo_dir = utils.get_full_repo_dir(settings, user, repo_name) result = handlers.create_repo(request, repo_name) self.assertTrue(user in result) self.assertTrue(repo_name in result) self.assertTrue(os.path.isdir(full_repo_dir))