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


Python tests.SkillFactory类代码示例

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


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


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