当前位置: 首页>>代码示例>>Python>>正文


Python UserProfile.extract_document方法代码示例

本文整理汇总了Python中mozillians.users.models.UserProfile.extract_document方法的典型用法代码示例。如果您正苦于以下问题:Python UserProfile.extract_document方法的具体用法?Python UserProfile.extract_document怎么用?Python UserProfile.extract_document使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mozillians.users.models.UserProfile的用法示例。


在下文中一共展示了UserProfile.extract_document方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_extract_document

# 需要导入模块: from mozillians.users.models import UserProfile [as 别名]
# 或者: from mozillians.users.models.UserProfile import extract_document [as 别名]
    def test_extract_document(self):
        user = UserFactory.create(userprofile={'allows_community_sites': False,
                                               'allows_mozilla_sites': False,
                                               'full_name': 'Nikos Koukos',
                                               'bio': 'This is my bio'})
        profile = user.userprofile
        group_1 = GroupFactory.create()
        group_2 = GroupFactory.create()
        skill_1 = SkillFactory.create()
        skill_2 = SkillFactory.create()
        LanguageFactory.create(code='fr', userprofile=profile)
        LanguageFactory.create(code='en', userprofile=profile)
        group_1.add_member(profile)
        group_2.add_member(profile)
        profile.skills.add(skill_1)
        profile.skills.add(skill_2)

        result = UserProfile.extract_document(profile.id)
        ok_(isinstance(result, dict))
        eq_(result['id'], profile.id)
        eq_(result['is_vouched'], profile.is_vouched)
        eq_(result['region'], 'Attika')
        eq_(result['city'], 'Athens')
        eq_(result['allows_community_sites'], profile.allows_community_sites)
        eq_(result['allows_mozilla_sites'], profile.allows_mozilla_sites)
        eq_(set(result['country']), set(['gr', 'Greece']))
        eq_(result['fullname'], profile.full_name.lower())
        eq_(result['name'], profile.full_name.lower())
        eq_(result['bio'], profile.bio)
        eq_(result['has_photo'], False)
        eq_(result['groups'], [group_1.name, group_2.name])
        eq_(result['skills'], [skill_1.name, skill_2.name])
        eq_(set(result['languages']),
            set([u'en', u'fr', u'english', u'french', u'français']))
开发者ID:WillsMcGarnigle,项目名称:mozillians,代码行数:36,代码来源:test_models.py

示例2: test_extract_document

# 需要导入模块: from mozillians.users.models import UserProfile [as 别名]
# 或者: from mozillians.users.models.UserProfile import extract_document [as 别名]
    def test_extract_document(self):
        country = CountryFactory.create(name="Greece", code="gr")
        region = RegionFactory.create(name="attika", country=country)
        city = CityFactory.create(name="athens", region=region, country=country)
        user = UserFactory.create(
            userprofile={
                "geo_city": city,
                "geo_region": region,
                "allows_community_sites": False,
                "allows_mozilla_sites": False,
                "geo_country": country,
                "full_name": "Nikos Koukos",
                "bio": "This is my bio",
            }
        )
        profile = user.userprofile
        group_1 = GroupFactory.create()
        group_2 = GroupFactory.create()
        skill_1 = SkillFactory.create()
        skill_2 = SkillFactory.create()
        LanguageFactory.create(code="fr", userprofile=profile)
        LanguageFactory.create(code="en", userprofile=profile)
        group_1.add_member(profile)
        group_2.add_member(profile)
        profile.skills.add(skill_1)
        profile.skills.add(skill_2)

        result = UserProfile.extract_document(user.userprofile.id)
        ok_(isinstance(result, dict))
        eq_(result["id"], profile.id)
        eq_(result["is_vouched"], profile.is_vouched)
        eq_(result["region"], region.name)
        eq_(result["city"], city.name)
        eq_(result["allows_community_sites"], profile.allows_community_sites)
        eq_(result["allows_mozilla_sites"], profile.allows_mozilla_sites)
        eq_(result["country"], country.name)
        eq_(result["fullname"], profile.full_name.lower())
        eq_(result["name"], profile.full_name.lower())
        eq_(result["bio"], profile.bio)
        eq_(result["has_photo"], False)
        eq_(result["groups"], [group_1.name, group_2.name])
        eq_(result["skills"], [skill_1.name, skill_2.name])
        eq_(set(result["languages"]), set([u"en", u"fr", u"english", u"french", u"français"]))
开发者ID:J0WI,项目名称:mozillians,代码行数:45,代码来源:test_models.py

示例3: test_extract_document

# 需要导入模块: from mozillians.users.models import UserProfile [as 别名]
# 或者: from mozillians.users.models.UserProfile import extract_document [as 别名]
    def test_extract_document(self):
        group_1 = GroupFactory.create()
        group_2 = GroupFactory.create()
        skill_1 = SkillFactory.create()
        skill_2 = SkillFactory.create()
        language_1 = LanguageFactory.create()
        language_2 = LanguageFactory.create()
        user = UserFactory.create(userprofile={'website': 'bestplaceonthenet.com',
                                               'city': 'athens',
                                               'region': 'attika',
                                               'allows_community_sites': False,
                                               'allows_mozilla_sites': False,
                                               'country': 'gr',
                                               'full_name': 'Nikos Koukos',
                                               'bio': 'This is my bio'})
        profile = user.userprofile
        profile.groups.add(group_1)
        profile.groups.add(group_2)
        profile.skills.add(skill_1)
        profile.skills.add(skill_2)
        profile.languages.add(language_1)
        profile.languages.add(language_2)

        result = UserProfile.extract_document(user.userprofile.id)
        ok_(isinstance(result, dict))
        eq_(result['id'], profile.id)
        eq_(result['is_vouched'], profile.is_vouched)
        eq_(result['website'], profile.website)
        eq_(result['region'], profile.region)
        eq_(result['city'], profile.city)
        eq_(result['allows_community_sites'], profile.allows_community_sites)
        eq_(result['allows_mozilla_sites'], profile.allows_mozilla_sites)
        eq_(result['country'], ['gr', 'greece'])
        eq_(result['fullname'], profile.full_name.lower())
        eq_(result['name'], profile.full_name.lower())
        eq_(result['bio'], profile.bio)
        eq_(result['has_photo'], False)
        eq_(result['groups'], [group_1.name, group_2.name])
        eq_(result['skills'], [skill_1.name, skill_2.name])
        eq_(result['languages'], [language_1.name, language_2.name])
开发者ID:TheGallery,项目名称:mozillians,代码行数:42,代码来源:test_models.py


注:本文中的mozillians.users.models.UserProfile.extract_document方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。