コード例 #1
0
 def test_get_org_title_sq(self):
     title_translated = {
         'en': 'title on english',
         'mk': u'наслов на македонски',
         'sq': 'titulli i shqiptar'
     }
     org = factories.Organization(title_translated=title_translated)
     set_lang('sq')
     result = helpers.get_org_title(org['id'])
     assert result == u'titulli i shqiptar'
コード例 #2
0
 def test_get_org_description_sq(self):
     description_translated = {
         'en': 'description on english',
         'mk': u'опис на македонски',
         'sq': u'përshkrimi i shqiptar'
     }
     org = factories.Organization(
         description_translated=description_translated)
     set_lang('sq')
     result = helpers.get_org_description(org['id'])
     assert result == u'përshkrimi i shqiptar'
コード例 #3
0
    def test_translate_field_mk(self):
        data_dict = {
            'title_translated': {
                'mk': 'тест',
                'en': 'test',
            }
        }

        set_lang('mk')
        result = helpers.translate_field(data_dict, 'title')

        assert result == 'тест'
コード例 #4
0
    def test_package_search(self):
        title_translated = {
            'en': 'title on english',
            'mk': u'наслов на македонски',
            'sq': 'titulli i shqiptar'
        }
        dataset = create_dataset(title_translated=title_translated,
                                 name='testtranstitle')

        data_dict = {'fq': 'name:testtranstitle'}
        set_lang('mk')
        result = test_helpers.call_action('package_search', **data_dict)
        assert result.get('results')[0]['title'] == u'наслов на македонски'
コード例 #5
0
 def test_group_show_sq(self):
     data_dict = {
         'title_translated': {
             'mk': 'title mk',
             'en': 'title en',
             'sq': 'title sq'
         },
         'description_translated': {
             'mk': 'description mk',
             'en': 'description en',
             'sq': 'description sq'
         },
         'type': 'group',
     }
     org = factories.Group(**data_dict)
     set_lang('sq')
     result = test_helpers.call_action('group_show', id=org.get('id'))
     assert result.get('title') == 'title sq'
     assert result.get('display_name') == 'title sq'
     assert result.get('description') == 'description sq'
コード例 #6
0
 def test_organization_show_mk(self):
     data_dict = {
         'title_translated': {
             'mk': 'title mk',
             'en': 'title en',
             'sq': 'title sq'
         },
         'description_translated': {
             'mk': 'description mk',
             'en': 'description en',
             'sq': 'description sq'
         }
     }
     org = factories.Organization(**data_dict)
     set_lang('mk')
     result = test_helpers.call_action('organization_show',
                                       id=org.get('id'))
     assert result.get('title') == 'title mk'
     assert result.get('display_name') == 'title mk'
     assert result.get('description') == 'description mk'
コード例 #7
0
    def test_get_org_title_desc(self):
        title_translated = {
            'en': 'title on english',
            'mk': u'наслов на македонски',
            'sq': 'titulli i shqiptar'
        }

        description_translated = {
            'en': 'description on english',
            'mk': u'опис на македонски',
            'sq': u'përshkrimi i shqiptar'
        }

        org = factories.Organization(
            title_translated=title_translated,
            description_translated=description_translated)

        set_lang('mk')
        title, desc = helpers.get_org_title_desc(org)
        assert title == u'наслов на македонски'
        assert desc == u'опис на македонски'

        set_lang('sq')
        title, desc = helpers.get_org_title_desc(org)
        assert title == u'titulli i shqiptar'
        assert desc == u'përshkrimi i shqiptar'

        set_lang('en')
        title, desc = helpers.get_org_title_desc(org)
        assert title == u'title on english'
        assert desc == u'description on english'
コード例 #8
0
 def test_resource_show_sq(self):
     dataset = create_dataset()
     data_dict = {
         'package_id': dataset.get('id'),
         'url': 'http://www.google.com',
         'name_translated': {
             'mk': 'name mk',
             'en': 'name en',
             'sq': 'name sq'
         },
         'description_translated': {
             'mk': 'description mk',
             'en': 'description en',
             'sq': 'description sq'
         }
     }
     resource = factories.Resource(**data_dict)
     set_lang('sq')
     result = test_helpers.call_action('resource_show',
                                       id=resource.get('id'))
     assert result.get('name') == 'name sq'
     assert result.get('description') == 'description sq'
コード例 #9
0
    def test_get_translated(self):
        title_translated = {
            'en': 'title on english',
            'mk': u'наслов на македонски',
            'sq': 'titulli i shqiptar'
        }

        json_str = json.dumps(title_translated)

        set_lang('mk')
        t = helpers.get_translated(json_str)
        assert t == u'наслов на македонски'

        set_lang('en')
        t = helpers.get_translated(json_str)
        assert t == 'title on english'

        set_lang('sq')
        t = helpers.get_translated(json_str)
        assert t == 'titulli i shqiptar'