Commit 3fb74cf7 authored by Enrico Zini's avatar Enrico Zini
Browse files

Fixed deploy tests after the rename from master to main

parent 710d823c
...@@ -13,12 +13,12 @@ class Env: ...@@ -13,12 +13,12 @@ class Env:
self.queuedir = os.path.join(self.workdir, "queue") self.queuedir = os.path.join(self.workdir, "queue")
os.mkdir(self.queuedir) os.mkdir(self.queuedir)
self.repodir = os.path.join(self.workdir, "repo") self.repodir = os.path.join(self.workdir, "repo")
self.master_hexsha = None self.main_hexsha = None
def create_repo(self): def create_repo(self):
repo = git.Repo.init(self.repodir, bare=False) repo = git.Repo.init(self.repodir, bare=False, initial_branch='main')
commit = repo.index.commit("Creating a branch") commit = repo.index.commit("Creating a branch")
self.master_hexsha = commit.hexsha self.main_hexsha = commit.hexsha
# Not available on current debian stable # Not available on current debian stable
# repo.close() # repo.close()
...@@ -34,21 +34,21 @@ class TestDeploy(TestCase): ...@@ -34,21 +34,21 @@ class TestDeploy(TestCase):
def test_select_branch(self): def test_select_branch(self):
with self.env() as env: with self.env() as env:
with open(os.path.join(env.queuedir, env.master_hexsha + ".deploy"), "w"): with open(os.path.join(env.queuedir, env.main_hexsha + ".deploy"), "w"):
pass pass
with open(os.path.join(env.queuedir, "1111111111111111111111111111111111111111.deploy"), "w"): with open(os.path.join(env.queuedir, "1111111111111111111111111111111111111111.deploy"), "w"):
pass pass
with self.settings(DEPLOY_BRANCH="master"): with self.settings(DEPLOY_BRANCH="main"):
deployer = Deployer(root=env.repodir) deployer = Deployer(root=env.repodir)
deployer.select_branch(fetch=False) deployer.select_branch(fetch=False)
self.assertEqual(deployer.branch, "master") self.assertEqual(deployer.branch, "main")
self.assertEqual(deployer.ref.commit.hexsha, env.master_hexsha) self.assertEqual(deployer.ref.commit.hexsha, env.main_hexsha)
def test_select_branch_fail(self): def test_select_branch_fail(self):
with self.env() as env: with self.env() as env:
with open(os.path.join(env.queuedir, "1111111111111111111111111111111111111111.deploy"), "w"): with open(os.path.join(env.queuedir, "1111111111111111111111111111111111111111.deploy"), "w"):
pass pass
with self.settings(DEPLOY_BRANCH="master"): with self.settings(DEPLOY_BRANCH="main"):
deployer = Deployer(root=env.repodir) deployer = Deployer(root=env.repodir)
with self.assertRaises(Fail) as e: with self.assertRaises(Fail) as e:
deployer.select_branch(fetch=False) deployer.select_branch(fetch=False)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment