@pytest.mark.parametrize('path,expect_code', (('/', None), ('?language=pt', 'pt'), ('/?language=ar', 'ar'), ('/industries?language=es', 'es'), ('/industries/?language=zh-hans', 'zh-hans'), ('/industries/aerospace?language=de', 'de'), ('/industries/automotive/?language=fr', 'fr'), ('?lang=fr', 'fr'), ('?language=de&lang=de', 'de'), ('?lang=pt&language=es', 'es')))
def test_get_language_from_querystring(path, expect_code, rf):
    url = reverse('index')
    request = rf.get((url + path))
    language_code = helpers.get_language_from_querystring(request)
    assert (language_code == expect_code)
@pytest.mark.parametrize('path,expect_code', (('/', None), ('?language=pt', 'pt'), ('/?language=ar', 'ar'), ('/industries?language=es', 'es'), ('/industries/?language=zh-hans', 'zh-hans'), ('/industries/aerospace?language=de', 'de'), ('/industries/automotive/?language=fr', 'fr'), ('?lang=fr', 'fr'), ('?language=de&lang=de', 'de'), ('?lang=pt&language=es', 'es')))
def test_get_language_from_querystring(path, expect_code, rf):
    url = reverse('index')
    request = rf.get((url + path))
    language_code = helpers.get_language_from_querystring(request)
    assert (language_code == expect_code)