diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2022-09-09 14:26:44 +0300 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2022-09-09 14:26:44 +0300 |
commit | 4f5c629c37bb6d2b2b62c88b445087ca64c82f1b (patch) | |
tree | 7f900da04c4fb850bd2030a99cfbf243637cf1db /tests | |
parent | tests: use staticmethod to decrease warnings (diff) | |
download | pkgdev-4f5c629c37bb6d2b2b62c88b445087ca64c82f1b.tar.gz pkgdev-4f5c629c37bb6d2b2b62c88b445087ca64c82f1b.tar.bz2 pkgdev-4f5c629c37bb6d2b2b62c88b445087ca64c82f1b.zip |
mask: add tests for invalid author
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scripts/test_pkgdev_mask.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/scripts/test_pkgdev_mask.py b/tests/scripts/test_pkgdev_mask.py index 29a2764..88898c0 100644 --- a/tests/scripts/test_pkgdev_mask.py +++ b/tests/scripts/test_pkgdev_mask.py @@ -194,6 +194,32 @@ class TestPkgdevMask: self.script() assert self.profile.masks == frozenset([atom_cls('cat/masked'), atom_cls('=cat/pkg-0')]) + def test_invalid_author(self, capsys): + for line in ( + '# Random Dev <random.dev@email.com>', + '# Random Dev <random.dev@email.com) (2021-03-24)', + '# Random Dev (2021-03-24)', + '# Random Dev <random.dev@email.com> 2021-03-24', + '# Random Dev <random.dev@email.com> (24-03-2021)', + ): + self.masks_path.write_text(textwrap.dedent(f"""\ + # Random Dev <random.dev@email.com> (2021-03-24) + # masked + cat/masked + + {line} + # masked + cat/masked2 + """)) + + with os_environ(EDITOR="sed -i '1s/$/mask comment/'"), \ + patch('sys.argv', self.args + ['=cat/pkg-0']), \ + pytest.raises(SystemExit), \ + chdir(pjoin(self.repo.path)): + self.script() + _, err = capsys.readouterr() + assert 'pkgdev mask: error: invalid author, lineno 5' in err + def test_last_rites(self): for rflag in ('-r', '--rites'): for args in ([rflag], [rflag, '14']): |