mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
gitweb: tests: Fix test failures if initial default branch is not master
Since Git 2.28, it is possible to change initial default branch name using the configuration option init.defaultBranch. Closes #2101. Signed-off-by: Veiko Aasa <veiko17@disroot.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
a8df4bcdb7
commit
abbec6b8e9
@ -17,7 +17,6 @@ REPO_DATA = {
|
|||||||
'description': '',
|
'description': '',
|
||||||
'owner': '',
|
'owner': '',
|
||||||
'access': 'private',
|
'access': 'private',
|
||||||
'default_branch': 'master',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -65,9 +64,11 @@ def test_create_repo(call_action):
|
|||||||
'create-repo', '--name', REPO_NAME, '--description', '', '--owner', '',
|
'create-repo', '--name', REPO_NAME, '--description', '', '--owner', '',
|
||||||
'--is-private', '--keep-ownership'
|
'--is-private', '--keep-ownership'
|
||||||
])
|
])
|
||||||
|
repo = json.loads(call_action(['repo-info', '--name', REPO_NAME]))
|
||||||
|
default_branch = repo.pop('default_branch')
|
||||||
|
|
||||||
assert json.loads(call_action(['repo-info', '--name',
|
assert repo == REPO_DATA
|
||||||
REPO_NAME])) == REPO_DATA
|
assert len(default_branch) > 0
|
||||||
|
|
||||||
|
|
||||||
def test_change_repo_medatada(call_action, existing_repo):
|
def test_change_repo_medatada(call_action, existing_repo):
|
||||||
@ -77,7 +78,6 @@ def test_change_repo_medatada(call_action, existing_repo):
|
|||||||
'description': 'description2',
|
'description': 'description2',
|
||||||
'owner': 'owner2',
|
'owner': 'owner2',
|
||||||
'access': 'public',
|
'access': 'public',
|
||||||
'default_branch': 'master',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
call_action([
|
call_action([
|
||||||
@ -89,9 +89,10 @@ def test_change_repo_medatada(call_action, existing_repo):
|
|||||||
call_action([
|
call_action([
|
||||||
'set-repo-access', '--name', REPO_NAME, '--access', new_data['access']
|
'set-repo-access', '--name', REPO_NAME, '--access', new_data['access']
|
||||||
])
|
])
|
||||||
|
repo = json.loads(call_action(['repo-info', '--name', REPO_NAME]))
|
||||||
|
del repo['default_branch']
|
||||||
|
|
||||||
assert json.loads(call_action(['repo-info', '--name',
|
assert repo == new_data
|
||||||
REPO_NAME])) == new_data
|
|
||||||
|
|
||||||
|
|
||||||
def test_rename_repository(call_action, existing_repo):
|
def test_rename_repository(call_action, existing_repo):
|
||||||
@ -101,21 +102,17 @@ def test_rename_repository(call_action, existing_repo):
|
|||||||
call_action(['rename-repo', '--oldname', REPO_NAME, '--newname', new_name])
|
call_action(['rename-repo', '--oldname', REPO_NAME, '--newname', new_name])
|
||||||
with pytest.raises(RuntimeError, match='Repository not found'):
|
with pytest.raises(RuntimeError, match='Repository not found'):
|
||||||
call_action(['repo-info', '--name', REPO_NAME])
|
call_action(['repo-info', '--name', REPO_NAME])
|
||||||
|
repo = json.loads(call_action(['repo-info', '--name', new_name]))
|
||||||
|
|
||||||
assert json.loads(call_action(['repo-info', '--name', new_name])) == {
|
assert repo['name'] == new_name
|
||||||
**REPO_DATA,
|
|
||||||
**{
|
|
||||||
'name': new_name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_branches(call_action, existing_repo):
|
def test_get_branches(call_action, existing_repo):
|
||||||
"""Test getting all the branches of the repository."""
|
"""Test getting all the branches of the repository."""
|
||||||
assert json.loads(call_action(['get-branches', '--name', REPO_NAME])) == {
|
result = json.loads(call_action(['get-branches', '--name', REPO_NAME]))
|
||||||
"default_branch": "master",
|
|
||||||
"branches": []
|
assert 'default_branch' in result
|
||||||
}
|
assert result['branches'] == []
|
||||||
|
|
||||||
|
|
||||||
def test_delete_repository(call_action, existing_repo):
|
def test_delete_repository(call_action, existing_repo):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user