# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os

from babelfish import Language, language_converters
import pytest
from vcr import VCR

from subliminal.exceptions import AuthenticationError, ConfigurationError
from subliminal.providers.addic7ed import Addic7edProvider, Addic7edSubtitle


vcr = VCR(path_transformer=lambda path: path + '.yaml',
          match_on=['method', 'scheme', 'host', 'port', 'path', 'query', 'body'],
          cassette_library_dir=os.path.join('tests', 'cassettes', 'addic7ed'))


@pytest.mark.converter
def test_converter_convert_alpha3_country_script():
    assert language_converters['addic7ed'].convert('srp', None, 'Cyrl') == 'Serbian (Cyrillic)'


@pytest.mark.converter
def test_converter_convert_alpha3_country():
    assert language_converters['addic7ed'].convert('por', 'BR') == 'Portuguese (Brazilian)'


@pytest.mark.converter
def test_converter_convert_alpha3():
    assert language_converters['addic7ed'].convert('eus') == 'Euskera'


@pytest.mark.converter
def test_converter_convert_alpha3_name_converter():
    assert language_converters['addic7ed'].convert('fra') == 'French'


@pytest.mark.converter
def test_converter_reverse():