def test_get_metadata(self):
    license = LicenseFactory(**{'license_code': 'by-nc', 'version': '3.0', 'title_english': 'The Title', 'jurisdiction_code': 'xyz', 'permits_derivative_works': False, 'permits_reproduction': False, 'permits_distribution': True, 'permits_sharing': True, 'requires_share_alike': True, 'requires_notice': True, 'requires_attribution': True, 'requires_source_code': True, 'prohibits_commercial_use': True, 'prohibits_high_income_nation_use': False})
    LegalCodeFactory(license=license, language_code='pt')
    LegalCodeFactory(license=license, language_code='en')
    data = license.get_metadata()
    expected_data = {'jurisdiction': 'xyz', 'license_code': 'by-nc', 'permits_derivative_works': False, 'permits_distribution': True, 'permits_reproduction': False, 'permits_sharing': True, 'prohibits_commercial_use': True, 'prohibits_high_income_nation_use': False, 'requires_attribution': True, 'requires_notice': True, 'requires_share_alike': True, 'requires_source_code': True, 'title_english': 'The Title', 'translations': {'en': {'deed': '/licenses/by-nc/3.0/xyz/', 'license': '/licenses/by-nc/3.0/xyz/legalcode', 'title': 'The Title'}, 'pt': {'deed': '/licenses/by-nc/3.0/xyz/deed.pt', 'license': '/licenses/by-nc/3.0/xyz/legalcode.pt', 'title': 'The Title'}}, 'version': '3.0'}
    for key in expected_data.keys():
        self.assertEqual(expected_data[key], data[key])
    license = LicenseFactory(**{'license_code': 'by-nc', 'version': '3.0', 'title_english': 'The Title', 'jurisdiction_code': '', 'permits_derivative_works': False, 'permits_reproduction': False, 'permits_distribution': True, 'permits_sharing': True, 'requires_share_alike': True, 'requires_notice': True, 'requires_attribution': True, 'requires_source_code': True, 'prohibits_commercial_use': True, 'prohibits_high_income_nation_use': False})
    LegalCodeFactory(license=license, language_code='en')
    data = license.get_metadata()
    expected_data = {'license_code': 'by-nc', 'permits_derivative_works': False, 'permits_distribution': True, 'permits_reproduction': False, 'permits_sharing': True, 'prohibits_commercial_use': True, 'prohibits_high_income_nation_use': False, 'requires_attribution': True, 'requires_notice': True, 'requires_share_alike': True, 'requires_source_code': True, 'title_english': 'The Title', 'translations': {'en': {'deed': '/licenses/by-nc/3.0/', 'license': '/licenses/by-nc/3.0/legalcode', 'title': 'The Title'}}, 'version': '3.0'}
    for key in expected_data.keys():
        self.assertEqual(expected_data[key], data[key])
def test_get_metadata(self):
    license = LicenseFactory(**{'license_code': 'by-nc', 'version': '3.0', 'title_english': 'The Title', 'jurisdiction_code': 'xyz', 'permits_derivative_works': False, 'permits_reproduction': False, 'permits_distribution': True, 'permits_sharing': True, 'requires_share_alike': True, 'requires_notice': True, 'requires_attribution': True, 'requires_source_code': True, 'prohibits_commercial_use': True, 'prohibits_high_income_nation_use': False})
    LegalCodeFactory(license=license, language_code='pt')
    LegalCodeFactory(license=license, language_code='en')
    data = license.get_metadata()
    expected_data = {'jurisdiction': 'xyz', 'license_code': 'by-nc', 'permits_derivative_works': False, 'permits_distribution': True, 'permits_reproduction': False, 'permits_sharing': True, 'prohibits_commercial_use': True, 'prohibits_high_income_nation_use': False, 'requires_attribution': True, 'requires_notice': True, 'requires_share_alike': True, 'requires_source_code': True, 'title_english': 'The Title', 'translations': {'en': {'deed': '/licenses/by-nc/3.0/xyz/', 'license': '/licenses/by-nc/3.0/xyz/legalcode', 'title': 'The Title'}, 'pt': {'deed': '/licenses/by-nc/3.0/xyz/deed.pt', 'license': '/licenses/by-nc/3.0/xyz/legalcode.pt', 'title': 'The Title'}}, 'version': '3.0'}
    for key in expected_data.keys():
        self.assertEqual(expected_data[key], data[key])
    license = LicenseFactory(**{'license_code': 'by-nc', 'version': '3.0', 'title_english': 'The Title', 'jurisdiction_code': , 'permits_derivative_works': False, 'permits_reproduction': False, 'permits_distribution': True, 'permits_sharing': True, 'requires_share_alike': True, 'requires_notice': True, 'requires_attribution': True, 'requires_source_code': True, 'prohibits_commercial_use': True, 'prohibits_high_income_nation_use': False})
    LegalCodeFactory(license=license, language_code='en')
    data = license.get_metadata()
    expected_data = {'license_code': 'by-nc', 'permits_derivative_works': False, 'permits_distribution': True, 'permits_reproduction': False, 'permits_sharing': True, 'prohibits_commercial_use': True, 'prohibits_high_income_nation_use': False, 'requires_attribution': True, 'requires_notice': True, 'requires_share_alike': True, 'requires_source_code': True, 'title_english': 'The Title', 'translations': {'en': {'deed': '/licenses/by-nc/3.0/', 'license': '/licenses/by-nc/3.0/legalcode', 'title': 'The Title'}}, 'version': '3.0'}
    for key in expected_data.keys():
        self.assertEqual(expected_data[key], data[key])