• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python tests.SkillFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mozillians.groups.tests.SkillFactory的典型用法代码示例。如果您正苦于以下问题:Python SkillFactory类的具体用法?Python SkillFactory怎么用?Python SkillFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: test_set_membership_skill_matches_alias

 def test_set_membership_skill_matches_alias(self):
     group_1 = SkillFactory.create(name="foo")
     group_2 = SkillFactory.create(name="lo")
     SkillAliasFactory.create(alias=group_2, name="bar")
     user = UserFactory.create()
     user.userprofile.set_membership(Skill, ["foo", "bar"])
     eq_(set(user.userprofile.skills.all()), set([group_1, group_2]))
开发者ID:J0WI,项目名称:mozillians,代码行数:7,代码来源:test_models.py


示例2: test_extract_document

    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 = UserProfileMappingType.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:royshouvik,项目名称:mozillians,代码行数:34,代码来源:test_models.py


示例3: test_index_skills

    def test_index_skills(self):
        user = UserFactory.create()
        skill_1 = SkillFactory.create()
        skill_2 = SkillFactory.create()
        SkillFactory.create()
        skill_1.members.add(user.userprofile)
        skill_2.members.add(user.userprofile)

        with self.login(user) as client:
            response = client.get(self.url, follow=True)
        eq_(response.status_code, 200)
        self.assertTemplateUsed(response, "groups/index_skills.html")
        eq_(set(response.context["groups"].paginator.object_list), set([skill_1, skill_2]))
开发者ID:ariestiyansyah,项目名称:mozillians,代码行数:13,代码来源:test_search.py


示例4: test_search_skills

    def test_search_skills(self):
        user = UserFactory.create()
        skill_1 = SkillFactory.create()
        SkillFactory.create()
        url = urlparams(reverse("groups:search_skills"), term=skill_1.name)
        with self.login(user) as client:
            response = client.get(url, follow=True, **{"HTTP_X_REQUESTED_WITH": "XMLHttpRequest"})
        eq_(response.status_code, 200)
        eq_(response.get("content-type"), "application/json")

        data = json.loads(response.content)
        eq_(len(data), 1, "Non autocomplete skills are included in search")
        eq_(data[0], skill_1.name)
开发者ID:ariestiyansyah,项目名称:mozillians,代码行数:13,代码来源:test_search.py


示例5: test_search_skills

    def test_search_skills(self):
        user = UserFactory.create()
        skill_1 = SkillFactory.create()
        SkillFactory.create()
        url = urlparams(reverse('groups:skills-autocomplete'), q=skill_1.name)
        with self.login(user) as client:
            response = client.get(url, follow=True,
                                  **{'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest'})
        eq_(response.status_code, 200)
        eq_(response.get('content-type'), 'application/json')

        data = json.loads(response.content)
        eq_(data['results'][0]['id'], skill_1.id)
开发者ID:fxa90id,项目名称:mozillians,代码行数:13,代码来源:test_search.py


示例6: test_search_skills

    def test_search_skills(self):
        user = UserFactory.create(userprofile={'is_vouched': True})
        skill_1 = SkillFactory.create(auto_complete=True)
        SkillFactory.create()
        url = urlparams(reverse('groups:search_skills'), term=skill_1.name)
        with self.login(user) as client:
            response = client.get(url, follow=True,
                                  **{'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest'})
        eq_(response.status_code, 200)
        eq_(response.get('content-type'), 'application/json')

        data = json.loads(response.content)
        eq_(len(data), 1, 'Non autocomplete skills are included in search')
        eq_(data[0], skill_1.name)
开发者ID:NightFury13,项目名称:mozillians,代码行数:14,代码来源:test_views.py


示例7: test_search_skills

    def test_search_skills(self):
        client = Client()
        skill_1 = SkillFactory.create()
        skill_2 = SkillFactory.create()
        user_1 = UserFactory.create(userprofile={'is_vouched': True})
        user_1.userprofile.skills.add(skill_1)
        user_2 = UserFactory.create(userprofile={'is_vouched': True})
        user_2.userprofile.skills.add(skill_2)

        url = urlparams(self.mozilla_resource_url, skills=skill_1.name)
        response = client.get(url, follow=True)
        data = json.loads(response.content)
        eq_(len(data['objects']), 1)
        eq_(data['objects'][0]['id'], unicode(user_1.userprofile.id))
开发者ID:TheGallery,项目名称:mozillians,代码行数:14,代码来源:test_api.py


示例8: setUp

    def setUp(self):
        voucher = UserFactory.create(userprofile={'is_vouched': True})
        self.user = UserFactory.create(
            userprofile={'is_vouched': True,
                         'vouched_by': voucher.userprofile})
        group = GroupFactory.create()
        self.user.userprofile.groups.add(group)
        skill = SkillFactory.create()
        self.user.userprofile.skills.add(skill)
        language = LanguageFactory.create()
        self.user.userprofile.languages.add(language)

        self.resource_url = reverse(
            'api_dispatch_list',
            kwargs={'api_name': 'v1', 'resource_name': 'users'})
        self.mozilla_app = APIAppFactory.create(
            owner=self.user, is_mozilla_app=True)
        self.mozilla_resource_url = urlparams(
            self.resource_url, app_name=self.mozilla_app.name,
            app_key=self.mozilla_app.key)
        self.community_app = APIAppFactory.create(
            owner=self.user, is_mozilla_app=False)
        self.community_resource_url = urlparams(
            self.resource_url, app_name=self.community_app.name,
            app_key=self.community_app.key)
开发者ID:TheGallery,项目名称:mozillians,代码行数:25,代码来源:test_api.py


示例9: setUp

 def setUp(self):
     self.skill = SkillFactory.create()
     # We must request the full path, with language, or the
     # LanguageMiddleware will convert the request to GET.
     self.url = reverse('groups:toggle_skill_subscription', prefix='/en-US/',
                        kwargs={'url': self.skill.url})
     self.user = UserFactory.create(userprofile={'is_vouched': True})
开发者ID:NightFury13,项目名称:mozillians,代码行数:7,代码来源:test_views.py


示例10: setUp

    def setUp(self):
        voucher = UserFactory.create()
        self.user = UserFactory.create(
            userprofile={'is_vouched': True,
                         'vouched_by': voucher.userprofile})
        group = GroupFactory.create()
        group.add_member(self.user.userprofile)
        skill = SkillFactory.create()
        self.user.userprofile.skills.add(skill)
        self.user.userprofile.externalaccount_set.create(type=ExternalAccount.TYPE_SUMO,
                                                         identifier='Apitest')

        self.resource_url = reverse(
            'api_dispatch_list',
            kwargs={'api_name': 'v1', 'resource_name': 'users'})
        self.mozilla_app = APIAppFactory.create(
            owner=self.user, is_mozilla_app=True)
        self.mozilla_resource_url = urlparams(
            self.resource_url, app_name=self.mozilla_app.name,
            app_key=self.mozilla_app.key)
        self.community_app = APIAppFactory.create(
            owner=self.user, is_mozilla_app=False)
        self.community_resource_url = urlparams(
            self.resource_url, app_name=self.community_app.name,
            app_key=self.community_app.key)
开发者ID:birajkarmakar,项目名称:mozillians,代码行数:25,代码来源:test_api.py


示例11: test_add_member

 def test_add_member(self):
     skill = SkillFactory.create()
     user = UserFactory.create()
     ok_(user.userprofile not in skill.members.all())
     skill.add_member(userprofile=user.userprofile)
     ok_(user.userprofile in skill.members.all())
     ok_(skill.has_member(userprofile=user.userprofile))
开发者ID:Acidburn0zzz,项目名称:mozillians,代码行数:7,代码来源:test_models.py


示例12: test_remove_member

 def test_remove_member(self):
     skill = SkillFactory.create()
     user = UserFactory.create()
     skill.members.add(user.userprofile)
     skill.remove_member(userprofile=user.userprofile)
     ok_(not skill.has_member(userprofile=user.userprofile))
     ok_(user.userprofile not in skill.members.all())
开发者ID:Acidburn0zzz,项目名称:mozillians,代码行数:7,代码来源:test_models.py


示例13: test_skill_member_count

    def test_skill_member_count(self):
        skill = SkillFactory.create(name='foo')
        users = UserFactory.create_batch(3)
        for u in users:
            skill.add_member(u.userprofile)

        eq_(Skill.objects.get(name='foo').member_count, 3)
开发者ID:akatsoulas,项目名称:mozillians,代码行数:7,代码来源:test_models.py


示例14: setUp

 def setUp(self):
     self.skill = SkillFactory.create()
     # We must request the full path, with language, or the
     # LanguageMiddleware will convert the request to GET.
     with override_script_prefix('/en-US/'):
         self.url = reverse('groups:toggle_skill_subscription',
                            kwargs={'url': self.skill.url})
     self.user = UserFactory.create()
开发者ID:akatsoulas,项目名称:mozillians,代码行数:8,代码来源:test_misc.py


示例15: test_show_leave_group_button_value_skill

    def test_show_leave_group_button_value_skill(self):
        skill = SkillFactory.create()
        user = UserFactory.create(userprofile={"is_vouched": True})
        url = reverse("groups:show_skill", kwargs={"url": skill.url})

        with self.login(user) as client:
            response = client.get(url, follow=True)
        eq_(response.status_code, 200)
        eq_(response.context["hide_leave_group_button"], False)
开发者ID:Narrator,项目名称:mozillians,代码行数:9,代码来源:test_views.py


示例16: test_extract_document

    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,代码行数:43,代码来源:test_models.py


示例17: test_show_leave_button_value_skill

    def test_show_leave_button_value_skill(self):
        skill = SkillFactory.create()
        user = UserFactory.create(userprofile={'is_vouched': True})
        skill.members.add(user.userprofile)
        url = reverse('groups:show_skill', kwargs={'url': skill.url})

        with self.login(user) as client:
            response = client.get(url, follow=True)
        eq_(response.status_code, 200)
        eq_(response.context['show_leave_button'], True)
开发者ID:Chinmay26,项目名称:mozillians,代码行数:10,代码来源:test_views_show.py


示例18: test_show_leave_button_value_skill

    def test_show_leave_button_value_skill(self):
        skill = SkillFactory.create()
        user = UserFactory.create()
        skill.members.add(user.userprofile)
        url = reverse("groups:show_skill", kwargs={"url": skill.url})

        with self.login(user) as client:
            response = client.get(url, follow=True)
        eq_(response.status_code, 200)
        eq_(response.context["show_leave_button"], True)
        ok_(not response.context["is_pending"])
开发者ID:J0WI,项目名称:mozillians,代码行数:11,代码来源:test_show.py


示例19: test_search_combined_skills_country

 def test_search_combined_skills_country(self):
     country = CountryFactory.create(code="fr")
     user_1 = UserFactory.create(userprofile={"geo_country": country})
     UserFactory.create(userprofile={"geo_country": country})
     skill = SkillFactory.create()
     user_1.userprofile.skills.add(skill)
     client = Client()
     url = urlparams(self.mozilla_resource_url, skills=skill.name, country=country.code)
     response = client.get(url, follow=True)
     data = json.loads(response.content)
     eq_(len(data["objects"]), 1)
     eq_(data["objects"][0]["id"], user_1.userprofile.id)
开发者ID:jensonk9,项目名称:mozillians,代码行数:12,代码来源:test_api.py


示例20: test_extract_document

    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,代码行数:40,代码来源:test_models.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python views._list_groups函数代码示例发布时间:2022-05-27
下一篇:
Python tests.GroupFactory类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap