<commit_before>import pytest

import ceph_deploy
from ceph_deploy.cli import get_parser


class TestParserMain(object):

    def setup(self):
        self.parser = get_parser()

    def test_verbose_true(self):
        args = self.parser.parse_args('--verbose forgetkeys'.split())
        assert args.verbose

    def test_verbose_default_is_false(self):
        args = self.parser.parse_args('forgetkeys'.split())
        assert not args.verbose

    def test_quiet_true(self):
        args = self.parser.parse_args('--quiet forgetkeys'.split())
        assert args.quiet

    def test_quiet_default_is_false(self):
        args = self.parser.parse_args('forgetkeys'.split())
        assert not args.quiet

    def test_verbose_quiet_are_mutually_exclusive(self, capsys):
        with pytest.raises(SystemExit):
            self.parser.parse_args('--verbose --quiet forgetkeys'.split())
        out, err = capsys.readouterr()
        assert 'not allowed with argument' in err

    def test_version(self, capsys):
        with pytest.raises(SystemExit):
            self.parser.parse_args('--version'.split())
        out, err = capsys.readouterr()
        assert err.strip() == ceph_deploy.__version__<commit_msg>[RM-11742] Add tests for top-level CLI arguments<commit_after>import pytest

import ceph_deploy
from ceph_deploy.cli import get_parser


class TestParserMain(object):

    def setup(self):
        self.parser = get_parser()

    def test_verbose_true(self):
        args = self.parser.parse_args('--verbose forgetkeys'.split())
        assert args.verbose

    def test_verbose_default_is_false(self):
        args = self.parser.parse_args('forgetkeys'.split())
        assert not args.verbose

    def test_quiet_true(self):
        args = self.parser.parse_args('--quiet forgetkeys'.split())
        assert args.quiet

    def test_quiet_default_is_false(self):
        args = self.parser.parse_args('forgetkeys'.split())
        assert not args.quiet

    def test_verbose_quiet_are_mutually_exclusive(self, capsys):
        with pytest.raises(SystemExit):
            self.parser.parse_args('--verbose --quiet forgetkeys'.split())
        out, err = capsys.readouterr()
        assert 'not allowed with argument' in err

    def test_version(self, capsys):
        with pytest.raises(SystemExit):
            self.parser.parse_args('--version'.split())
        out, err = capsys.readouterr()
        assert err.strip() == ceph_deploy.__version__

    def test_custom_username(self):
        args = self.parser.parse_args('--username trhoden forgetkeys'.split())
        assert args.username == 'trhoden'

    def test_default_username_is_none(self):
        args = self.parser.parse_args('forgetkeys'.split())
        assert args.username is None

    def test_overwrite_conf_default_false(self):
        args = self.parser.parse_args('forgetkeys'.split())
        assert not args.overwrite_conf

    def test_overwrite_conf_true(self):
        args = self.parser.parse_args('--overwrite-conf forgetkeys'.split())
        assert args.overwrite_conf

    def test_default_cluster_name(self):
        args = self.parser.parse_args('forgetkeys'.split())
        assert args.cluster == 'ceph'

    def test_custom_cluster_name(self):
        args = self.parser.parse_args('--cluster myhugecluster forgetkeys'.split())
        assert args.cluster == 'myhugecluster'

    def test_default_ceph_conf_is_none(self):
        args = self.parser.parse_args('forgetkeys'.split())
        assert args.ceph_conf is None

    def test_custom_ceph_conf(self):
        args = self.parser.parse_args('--ceph-conf /tmp/ceph.conf forgetkeys'.split())
        assert args.ceph_conf == '/tmp/ceph.conf'
{'fraction_non_alphanumeric': 0.11141157382368848, 'fraction_numerical': 0.0013520822065981612, 'mean_word_length': 3.096345514950166, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1672038', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1096, 'n_words': 213}