Esempio n. 1
0
    def test_main_section_exists(gen_config):
        """Test KeyError if no [main] section in config."""
        config = gen_config
        config.remove_section('main')

        with pytest.raises(KeyError):
            Config.check_config(config)
Esempio n. 2
0
    def test_torrent_file_dir_value_given(gen_config):
        """Test ValueError if no torrent_file_dir value given."""
        gen_config.set('main', 'torrent_file_dir', '')

        with pytest.raises(ValueError):
            Config.check_config(gen_config)
Esempio n. 3
0
    def test_torrent_file_dir_option_exists(gen_config):
        """Test KeyError if no torrent_file_dir option in config."""
        gen_config.remove_option('main', 'torrent_file_dir')

        with pytest.raises(KeyError):
            Config.check_config(gen_config)
Esempio n. 4
0
 def test_valid_config(gen_config):
     """Make sure read_config works with a valid config."""
     Config.check_config(gen_config)
Esempio n. 5
0
    def test_annouce_id_value_given(gen_config):
        """Test ValueError if no announce_id value given."""
        gen_config.set('redacted', 'announce_id', '')

        with pytest.raises(ValueError):
            Config.check_config(gen_config)
Esempio n. 6
0
    def test_announce_id_option_exists(gen_config):
        """Test KeyError if no announce_id option in config."""
        gen_config.remove_option('redacted', 'announce_id')

        with pytest.raises(KeyError):
            Config.check_config(gen_config)
Esempio n. 7
0
    def test_redacted_section_exists(gen_config):
        """Test KeyError if no [redacted] section in config."""
        gen_config.remove_section('redacted')

        with pytest.raises(KeyError):
            Config.check_config(gen_config)
Esempio n. 8
0
    def test_valid_torrent_file_dir(gen_config):
        """Test NotADirectoryError if torrent_file_dir doesn't exist."""
        gen_config.set('main', 'transcode_parent_dir', 'bad_dir')

        with pytest.raises(NotADirectoryError):
            Config.check_config(gen_config)