50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
from unittest.mock import patch
|
|
|
|
from aider_gitea.__main__ import parse_args
|
|
|
|
|
|
def test_parse_args_with_reviewers_and_assignees():
|
|
"""Test that reviewers and assignees arguments are correctly parsed."""
|
|
test_args = [
|
|
'--gitea-url',
|
|
'https://gitea.example.com',
|
|
'--owner',
|
|
'test-owner',
|
|
'--repo',
|
|
'test-repo',
|
|
'--reviewers',
|
|
'user1,user2',
|
|
'--assignees',
|
|
'user3,user4',
|
|
]
|
|
|
|
with patch('sys.argv', ['aider_gitea'] + test_args):
|
|
args = parse_args()
|
|
|
|
assert args.gitea_url == 'https://gitea.example.com'
|
|
assert args.owner == 'test-owner'
|
|
assert args.repo == 'test-repo'
|
|
assert args.reviewers == 'user1,user2'
|
|
assert args.assignees == 'user3,user4'
|
|
|
|
|
|
def test_parse_args_without_reviewers_and_assignees():
|
|
"""Test that the parser works without reviewers and assignees."""
|
|
test_args = [
|
|
'--gitea-url',
|
|
'https://gitea.example.com',
|
|
'--owner',
|
|
'test-owner',
|
|
'--repo',
|
|
'test-repo',
|
|
]
|
|
|
|
with patch('sys.argv', ['aider_gitea'] + test_args):
|
|
args = parse_args()
|
|
|
|
assert args.gitea_url == 'https://gitea.example.com'
|
|
assert args.owner == 'test-owner'
|
|
assert args.repo == 'test-repo'
|
|
assert args.reviewers is None
|
|
assert args.assignees is None
|