'Test that defined locale fallbacks are used as header locales,
with the following conditions:
* the article is not localized into the user-requested locale
* the article is not localized to any of the locales listed in the ACCEPT_LANGUAGE header
* the header locales do not have a defined fallback locale OR the article is not localized
into any of those defined fallback locales
* the user-requested locale has a defined fallback locale, but the article is
not localized into it
* one of the locales listed in the ACCEPT_LANGUAGE headers has a defined fallback locale
and the article is localized into that fallback locale
Test that the defined fallback locale is used'

def test_custom_locale_mapping_for_header_locale(self):

    header = 'ca,bn-IN;q=0.7,ja;q=0.3,'
    doc_content = self.get_data_from_translated_document(header=header, create_doc_locale='bn-BD', req_doc_locale='ca')
    en_content = 'This    article    is    in    English'
    trans_content = 'This    article    is    translated    into    bn-BD'
    assert (en_content not in doc_content)
    assert (trans_content in doc_content)
    header = 'ar,bn-IN;q=0.7,ja;q=0.3,'
    doc_content = self.get_data_from_translated_document(header=header, create_doc_locale='bn-BD', req_doc_locale='ar')
    en_content = 'This    article    is    in    English'
    trans_content = 'This    article    is    translated    into    bn-BD'
    assert (en_content not in doc_content)
    assert (trans_content in doc_content)
