本文整理汇总了Python中mozillians.api.tests.APIAppFactory类的典型用法代码示例。如果您正苦于以下问题:Python APIAppFactory类的具体用法?Python APIAppFactory怎么用?Python APIAppFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了APIAppFactory类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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
示例2: 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
示例3: test_community_app
def test_community_app(self):
app = APIAppFactory.create(is_mozilla_app=False)
request = RequestFactory()
request.GET = {'app_key': app.key, 'app_name': app.name}
authentication = AppAuthentication()
authentication.is_authenticated(request)
eq_(request.GET.get('restricted'), True)
开发者ID:TechnoAyan,项目名称:mozillians,代码行数:7,代码来源:test_authenticators.py
示例4: 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:prafullakiran,项目名称:mozillians,代码行数:19,代码来源:test_api.py
示例5: setUp
def setUp(self):
voucher = UserFactory.create()
country = CountryFactory()
region = RegionFactory()
city = CityFactory()
self.user = UserFactory.create(
userprofile={"vouched": False, "geo_country": country, "geo_region": region, "geo_city": city}
)
self.user.userprofile.vouch(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:jensonk9,项目名称:mozillians,代码行数:24,代码来源:test_api.py
示例6: test_invalid_app_key
def test_invalid_app_key(self):
app = APIAppFactory.create()
request = RequestFactory()
request.GET = {'app_key': 'invalid', 'app_name': app.name}
authentication = AppAuthentication()
eq_(authentication.is_authenticated(request), False)
开发者ID:TechnoAyan,项目名称:mozillians,代码行数:6,代码来源:test_authenticators.py
示例7: test_empty_app_name
def test_empty_app_name(self):
app = APIAppFactory.create()
request = RequestFactory()
request.GET = {'app_key': app.key}
authentication = AppAuthentication()
eq_(authentication.is_authenticated(request), False)
开发者ID:TechnoAyan,项目名称:mozillians,代码行数:6,代码来源:test_authenticators.py
示例8: test_valid_app
def test_valid_app(self):
app = APIAppFactory.create()
request = RequestFactory()
request.GET = {'app_key': app.key, 'app_name': app.name}
authentication = AppAuthentication()
ok_(authentication.is_authenticated(request))
开发者ID:TechnoAyan,项目名称:mozillians,代码行数:6,代码来源:test_authenticators.py
示例9: setUp
def setUp(self):
self.resource_url = reverse("api_dispatch_list", kwargs={"api_name": "v1", "resource_name": "skills"})
self.user = UserFactory.create()
self.app = APIAppFactory.create(owner=self.user, is_mozilla_app=True)
self.resource_url = urlparams(self.resource_url, app_name=self.app.name, app_key=self.app.key)
开发者ID:GVRGowtham,项目名称:mozillians,代码行数:5,代码来源:test_api_v1.py
注:本文中的mozillians.api.tests.APIAppFactory类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论