def test_get_legalcode_for_language_code(self):
    license = LicenseFactory()
    lc_pt = LegalCodeFactory(license=license, language_code='pt')
    lc_en = LegalCodeFactory(license=license, language_code='en')
    with override(language='pt'):
        result = license.get_legalcode_for_language_code(None)
        self.assertEqual(lc_pt.id, result.id)
    result = license.get_legalcode_for_language_code('pt')
    self.assertEqual(lc_pt.id, result.id)
    result = license.get_legalcode_for_language_code('en')
    self.assertEqual(lc_en.id, result.id)
    with self.assertRaises(LegalCode.DoesNotExist):
        license.get_legalcode_for_language_code('en_us')
    result = license.get_legalcode_for_language_code('en-us')
    self.assertEqual(lc_en.id, result.id)
def test_get_legalcode_for_language_code(self):
    license = LicenseFactory()
    lc_pt = LegalCodeFactory(license=license, language_code='pt')
    lc_en = LegalCodeFactory(license=license, language_code='en')
    with override(language='pt'):
        result = license.get_legalcode_for_language_code(None)
        self.assertEqual(lc_pt.id, result.id)
    result = license.get_legalcode_for_language_code('pt')
    self.assertEqual(lc_pt.id, result.id)
    result = license.get_legalcode_for_language_code('en')
    self.assertEqual(lc_en.id, result.id)
    with self.assertRaises(LegalCode.DoesNotExist):
        license.get_legalcode_for_language_code('en_us')
    result = license.get_legalcode_for_language_code('en-us')
    self.assertEqual(lc_en.id, result.id)