Skip to content

Commit 4f5c629

Browse files
committed
mask: add tests for invalid author
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
1 parent 70f58af commit 4f5c629

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

tests/scripts/test_pkgdev_mask.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,32 @@ def test_existing_masks(self):
194194
self.script()
195195
assert self.profile.masks == frozenset([atom_cls('cat/masked'), atom_cls('=cat/pkg-0')])
196196

197+
def test_invalid_author(self, capsys):
198+
for line in (
199+
'# Random Dev <random.dev@email.com>',
200+
'# Random Dev <random.dev@email.com) (2021-03-24)',
201+
'# Random Dev (2021-03-24)',
202+
'# Random Dev <random.dev@email.com> 2021-03-24',
203+
'# Random Dev <random.dev@email.com> (24-03-2021)',
204+
):
205+
self.masks_path.write_text(textwrap.dedent(f"""\
206+
# Random Dev <random.dev@email.com> (2021-03-24)
207+
# masked
208+
cat/masked
209+
210+
{line}
211+
# masked
212+
cat/masked2
213+
"""))
214+
215+
with os_environ(EDITOR="sed -i '1s/$/mask comment/'"), \
216+
patch('sys.argv', self.args + ['=cat/pkg-0']), \
217+
pytest.raises(SystemExit), \
218+
chdir(pjoin(self.repo.path)):
219+
self.script()
220+
_, err = capsys.readouterr()
221+
assert 'pkgdev mask: error: invalid author, lineno 5' in err
222+
197223
def test_last_rites(self):
198224
for rflag in ('-r', '--rites'):
199225
for args in ([rflag], [rflag, '14']):

0 commit comments

Comments
 (0)